[R] Indexing multi-dimensional table

davavra davavra at verizon.net
Thu Dec 22 19:30:50 CET 2011

>From help("[", package="base"): "An index value of NULL is treated as
> if it were integer(0).".

Yeah, I should have read it better.

>I don't think there is an easy way to achieve:
> y[,2:3,1,drop=FALSE]
>  using do.call("[") without explicitly specify the indices for that
> "missing" dimension, i.e.
>  If you're willing to use R.utils you can do:
> library("R.utils");
> extract(y, indices=list(2:3,1), dims=c(2,3), drop=TRUE);

Thanks, Henrik. I also wasn't aware of R.utils until today. I should do more
reading :)


View this message in context: http://r.789695.n4.nabble.com/Indexing-multi-dimensional-table-tp4224543p4226198.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list