Open kevinushey opened 10 years ago
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.
Similarily, why apply is evil (always drops dimensions if the function applied returns a scalar*)
apply
*vector of length one
Useful when you're expecting it, the cause of difficult to trace bugs when you're not. The terribly wonderful syntax
allows you to avoid dimension dropping explicitly.