[R] building a subscript programatically
Ernest Adrogué
eadrogue at gmx.net
Wed Nov 2 01:30:50 CET 2011
1/11/11 @ 20:22 (-0400), Comcast escriu:
> Leaving the indices empty should give you what I'm guessing you want/expect.
>
> x[,,2] #. TRUE would also work, just not in a list.
Exactly, but this only works if x has three dimensions. What I want is
x[,,2] if x has three dimensions, x[,,,2] if it has four, and so
forth. I cannot hard code [,,2] because I do not know how many
dimensions x will have, instead the subscript has to be built "on the
fly".
Ernest
More information about the R-help
mailing list