Hi,

how can I create an array of lists of three components?
This approach does not work:

n1 <- 2
n2 <- 4
n3 <- 5
res <- array(rep(vector("list",3), n1*n2*n3), dim = c(n1,n2,n3))
res[1,1,1] # is not a list with three components...

The goal is that res[1,1,1] is a list with three components. Also, appending the
components didn't work. For example, I tried:
component <- list(a = 4, b = "some text", c = 1)
for(i in 1:3) res[1,1,1] <- c(res[1,1,1], component[[i]])

Cheers,

Marius
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to