Skip to content
Prev 257230 / 398506 Next

Help me create a hyper-structure

On 18/04/2011 4:45 AM, Alaios wrote:
Something that may not be obvious is that

all.str[[1]][[2]][[3]]


can also be written as

all.str[[c(1,2,3)]]


This is useful when the structure is an irregular shape, because the vector c(1,2,3) could be stored in a variable, and on the next call it could have a different length.

Be careful though:  all.str[c(1,2,3)] (with single brackets) means something quite different:  it means

list(all.str[[1]], all.str[[2]], all.str[[3]])

i.e. a subset of the top level indices.

Duncan Murdoch