[R] sequence of vectors

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Mon Nov 19 16:13:37 CET 2007


try:

expand.grid(x1, x2, x3)


Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Marc Bernard" <bernarduse1 at yahoo.fr>
To: <r-help at stat.math.ethz.ch>
Sent: Monday, November 19, 2007 3:59 PM
Subject: [R] sequence of vectors


> Dear All,
>
>  I wonder if there is any R function to generate a sequence of 
> vectors from existing ones. For example:
>  x 1<- c(1,2,3)
>  x2 <- c(4,5)
>  x3 <- c(6,7,8)
>
>  The desired output is a list of all 3*2*3 = 18 possible 
> combinations of elements of x1,x2 and x3. One element for example is 
> (1,4,6).
>
>  Many thanks in advance,
>
>  Bernard
>
>
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list