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

discuss dimension dropping #13

Open
kevinushey opened this issue Nov 6, 2013 · 1 comment
Open

discuss dimension dropping #13

kevinushey opened this issue Nov 6, 2013 · 1 comment

Comments

@kevinushey
Copy link

m <- matrix(1:9, nrow=3)

class( m[1:2, ] ) ## matrix!
class( m[1, ] ) ## integer!

Useful when you're expecting it, the cause of difficult to trace bugs when you're not. The terribly wonderful syntax

m[1, , drop=FALSE]

allows you to avoid dimension dropping explicitly.

@kevinushey
Copy link
Author

Similarily, why apply is evil (always drops dimensions if the function applied returns a scalar*)

*vector of length one

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

1 participant