[R] Indexing issue

From: Swidan, Firas <swidanf_at_janelia.hhmi.org>
Date: Wed 02 Aug 2006 - 05:57:01 EST


R is having the following weird behavior and I am not sure if that is a feature or a bug:

I am working on the following "3D" array:

> bIm
, , 1

[1,] TRUE
[2,] TRUE
[3,] TRUE
[4,] TRUE
[5,] TRUE
> class(bIm)
[1] "array"

> dim(bIm)
[1] 5 1 1

When I try to get the first 2D subarray, the whole thing folds into a vector:

> bIm[,,1]
This causes a lot of trouble in the R code as one would have expected to get a 2D array but ends up with this "logical" vector.

Is this the way it was meant to be? Does not this behavior bother anyone else besides me?

Thanks for the help,

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Aug 02 07:36:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 03 Aug 2006 - 02:18:05 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.