[R] Lists to vectors...

kjetil halvorsen kjetilh at umsanet.edu.bo
Thu Sep 26 15:31:56 CEST 2002


> test <- list(1:3, 5:9, 3:7)
> test
[[1]]
[1] 1 2 3

[[2]]
[1] 5 6 7 8 9

[[3]]
[1] 3 4 5 6 7

> do.call("c", test)
 [1] 1 2 3 5 6 7 8 9 3 4 5 6 7


Kjetil Halvorsen

Kevin Karty wrote:
> 
> Hello, can anyone answer:
> 
> Is there a fast, vectorized way to convert a list of integer vectors, in
> which each vector has different length, to a single vector that is
> simply the concatenation of all the member vectors?  Or does one have to
> loop over the list and concatenate everything?
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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