Convert a list to a matrix or array?
> str(mylist)
List of 50
$ : logi [1:14] 0.2 0.3 0.2 ...
$ : logi [1:14] 0.1 0.3 0.6 ...
$ : logi [1:14] 0.2 0.9 0.1 ...
I want to convert (or write out) mylist
to 14 matrices with dim 5 10
or one array with dim 5 10 14
Example data:
mylist <- lapply(1:50, function(i) sample((1:14)/10, 14, repl=TRUE))
This will produce the desired array (with NAs for the nonnumeric values):
array(as.numeric(unlist(mylist)), dim=c(14, 5, 10))