Hi Andy,
I don't know of a generic function, but it is easy to write one
(horribly non generic):
lll2array <- function(lll) {
l <- length(lll)
m <- length(lll[[1]])
n <- length(lll[[1]][[1]])
a <- array(0,c(l,m,n))
for (i in 1:l) {
l2 <- lll[[i]]
stopifnot(length(l2) == m)
for (j in 1:m) {
l3 <- l2[[j]]
stopifnot(length(l3) == n)
a[i,j,] <- as.vector(l3,"numeric")
}
}
a
}
## test it
test_lll <- local({
test1 <- list(1,2)
test2 <- list(test1,test1,test1)
list(test2,test2,test2,test2)
})
test_lll # nasty
lll2array(test_lll) # nice
That said, possibly building up your data as an array in the first place
could be a better choice.
Best,
Tamas