[R] Indexing multi-dimensional table

David A Vavra davavra at verizon.net
Thu Dec 22 18:26:58 CET 2011

> (This does imply you knew the number of dimensions was 3.)

Yes, at run time.

>It looks as though the Nulls became 0's. So if you wanted to use  
>do.call(`[` then this succeeds:
>  do.call(`[`, list(tbl, x, 1:dim(tbl)[2], 1:dim(tbl)[3]) )
>As does this using the "empty comma" approach:
>  eval(parse(text= paste("tbl[ " ,x, " , , ]"))  )

I tried the eval course but that struck me as slower. Perhaps not? It's not
that I'm set on using '['. I was under the impression that was how the eval
expression is eventually parsed. I also thought the empty commas were
eventually passed as NULLs.

Wasn't aware of the 'str' function. Could come in handy down the road.



More information about the R-help mailing list