[R] building a subscript programatically

David Winsemius dwinsemius at comcast.net
Wed Nov 2 01:44:21 CET 2011

Yes,Ii did fail to read your post carefully and agree  do.call seems roundabout, but alternatives look even more tortured.

(You might want to include more context in the future.)

On Nov 1, 2011, at 8:30 PM, Ernest Adrogué <eadrogue at gmx.net> wrote:

> 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