Skip to content
Prev 286094 / 398502 Next

Query: list within a list

It's certainly possible and I don't think you get any grueling
inefficiencies. along the way.

Another way that might or might not make sense for you is to use a
nifty trick I saw Gabor and Duncan M use a few weeks ago: you can give
dimensionality to a list and then subset it in the "normal" ways:
e.g.,

x <- list(a = 1, b = 2, c = 3, d = 4)
dim(x) <- c(2,2)
colnames(x) <- c("a", "b")

x[2,]
x[,2]

x[[2]]]

x[,"a"]

Might be of help for some nifty indexing. (Or it might look so crazy
to scare folks away: your call)

Michael
On Wed, Feb 22, 2012 at 10:17 AM, Stefano Sofia
<stefano.sofia at regione.marche.it> wrote: