[R] Loss of dimensions in subsetting arrays
dwinsemius at comcast.net
Fri Oct 12 18:21:12 CEST 2012
On Oct 12, 2012, at 2:52 AM, Markku Karhunen wrote:
> Hi all,
> I've been wondering for a long time why R drops the dimensions of an array/matrix when you try to take a subset of one column. I mean this:
>  2 5 2
> 5 2 # so now dim(B) doesn't work
> NULL # so now nrow(C) doesn't work
> Typically, you can get rid of this by writing as.matrix, as.array(...) but that generates extra lines of code. This is really annoying. Does anybody know how to turn this behaviour off?
Read the help page for:
?"[" # especially regarding the drop parameter.
David Winsemius, MD
Alameda, CA, USA
More information about the R-help