[R] How can I create a vector of vector?

ctu at bigred.unl.edu ctu at bigred.unl.edu
Fri Aug 8 21:29:14 CEST 2008


Hi Jim,
x<-as.vector(list(c(31,2,3), c(1,2,5,34,5656),c(211,3243,5,343,3)))
> x[1]
[[1]]
[1] 31  2  3

> x[2]
[[1]]
[1]    1    2    5   34 5656

> x[3]
[[1]]
[1]  211 3243    5  343    3

Hope this helps
Chunhao


Quoting Jim <chunchiliu at gmail.com>:

> Dear All,
>
> How can I create a vector of vector in R?
> for example, I would input the data as follows:
> x[1] <- c(31,2,3)
> x[2] <- c(1,2,5,34,5656)
> x[3] <- c(211,3243,5,343,3)
>
> Jim Liu
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list