-
Notifications
You must be signed in to change notification settings - Fork 59
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
Why rcopy(R"array(1)") return 1 rather than [1]? #307
Comments
The problem is that R doesn't have scalars: "scalars" are just 1-element vectors. I made the judgement call here to have 1-element vectors copied as scalars, since that is presumably what most people would find useful. Note that in R an "array" is a multidimensional structure, i.e. a vector is not an array by default:
If you want |
Thanks for your explanation. I think rcopy(Vector, ...) is a useful design since the output type is always expected. Maybe this syntax can be officially documented. Alternatively, I may propose to add a flag in rcopy, like |
@simonbyrne This seems like a good issue to pin and close so that users see it right away when they come to ask what's going wrong with 1-element vectors. 😄 |
One feature in the RCall confused me.
Although both print the same "1", R considered them as different data types:
However, rcopy(...) returns the same value 1:
I think rcopy(a)=[ 1.0 ] could be more reasonable. Is there any reason why regard array(1) as 1?
The text was updated successfully, but these errors were encountered: