More on list to data frame (was: Re: [R] List to Data Frame
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Sep 18 08:22:14 CEST 2002
Ko-Kang Kevin Wang wrote:
>
> Hi,
>
> I've solved the problem. I unlisted the list into a matrix first.
>
> For those who are interested, this is what I did:
> FOO.mm <- matrix(rep(NA, length(unlist(FOO))),
> nrow = 25, ncol = 23)
> for(i in 1 : n) {
> FOO.mm[ ,i] <- unlist(FOO[[i]])
> }
> FRED <- as.data.frame(FOO.mm)
It's not that hard. If you want to coerce to matrix using unlist() (and *not* to a data.frame, which I mentioned in a previous message):
matrix(unlist(FOO), nrow = length(FOO[[1]]))
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list