Skip to content

Refine matrix element type message#149

Merged
selkamand merged 1 commit intomainfrom
codex/improve-assert_numeric-error-message
Feb 9, 2026
Merged

Refine matrix element type message#149
selkamand merged 1 commit intomainfrom
codex/improve-assert_numeric-error-message

Conversation

@selkamand
Copy link
Owner

Motivation

  • Improve clarity of non-numeric matrix/array error messages by extracting and using the element type when formatting the message in the numeric check.

Description

  • Update is_numeric_with_matrix_message in R/is_functions.R to store element_type <- typeof(x) and use it when constructing the matrix/array error string.

Testing

  • Ran devtools::document() which completed successfully; ran devtools::test() and all tests passed (1006 tests passed); ran devtools::check() which completed but reported 1 WARNING (qpdf not available) and 1 NOTE (unable to verify current time), causing R CMD check to return with warnings.

Codex Task

@selkamand selkamand linked an issue Feb 9, 2026 that may be closed by this pull request
@selkamand selkamand merged commit 721f2ef into main Feb 9, 2026
7 checks passed
@selkamand
Copy link
Owner Author

switching from class to typeof could be an interesting alternative approach. Not without its own quirks (e.g. returns 'integer' / 'double') instead of 'numeric'.

I think this current solution is fine though.

@selkamand selkamand deleted the codex/improve-assert_numeric-error-message branch February 9, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assert_numeric error is uninformative for matrices

1 participant