Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default method needed for as_array() #1283

Open
ralmond opened this issue Feb 24, 2025 · 1 comment
Open

Default method needed for as_array() #1283

ralmond opened this issue Feb 24, 2025 · 1 comment

Comments

@ralmond
Copy link

ralmond commented Feb 24, 2025

I generally expect as_XXX functions to be harmless if given an object of type XXX, but

> as_array(matrix(1:6,2,3))
Error in UseMethod("as_array", x) : 
  no applicable method for 'as_array' applied to an object of class "c('matrix', 'array', 'integer', 'numeric')"

The function base::as.array() does seem to have the default behavior.

May I suggest adding

as_array.default <- function (x) base::as.array.default(x)

To give the expected behavior.

@dfalbel
Copy link
Member

dfalbel commented Feb 24, 2025

@ralmond I agree! Do you want to send a PR with this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants