[R] group vectors of different length

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Mar 19 08:36:46 CET 2002



Francisco J Molina wrote:
> 
> If I have several vectors of different length. Is there any way to group
> them in R and call them with an integer (and index)?
> Let us assume that the number of vectors is not known before I run the
> script.

*Please* read "An Introduction to R"!

You want to use a list:

vec1 <- 1:10
vex2 <- 1:5
mylist <- list(vec1, vec2)
mylist[[2]]

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