Re: [R] creat list
livia wrote: Hi, I have a list named lista, which has 50 vectors and each vector has the length about 1200. I would like to creat a matrix out of lista. What I try now is cbind(lista[[1]],lista[[2]],...,lista[[50]]). I guess there would be an easy way of doing this. Could anyone give me some advice? matrix(unlist(lista), ncol=50) Uwe Ligges __ R-help@stat.math.ethz.ch 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.
Re: [R] creat list
Many thanks. Uwe Ligges wrote: livia wrote: Hi, I have a list named lista, which has 50 vectors and each vector has the length about 1200. I would like to creat a matrix out of lista. What I try now is cbind(lista[[1]],lista[[2]],...,lista[[50]]). I guess there would be an easy way of doing this. Could anyone give me some advice? matrix(unlist(lista), ncol=50) Uwe Ligges __ R-help@stat.math.ethz.ch 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. -- View this message in context: http://www.nabble.com/creat-list-tf4391162.html#a12520728 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch 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.
Re: [R] creat list
Try this: do.call(cbind, lista) On 9/6/07, livia [EMAIL PROTECTED] wrote: Hi, I have a list named lista, which has 50 vectors and each vector has the length about 1200. I would like to creat a matrix out of lista. What I try now is cbind(lista[[1]],lista[[2]],...,lista[[50]]). I guess there would be an easy way of doing this. Could anyone give me some advice? -- View this message in context: http://www.nabble.com/creat-list-tf4391162.html#a12519637 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch 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. __ R-help@stat.math.ethz.ch 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.