[R] sequence of vectors

John Kane jrkrideau at yahoo.ca
Mon Nov 19 16:06:19 CET 2007


?expand.grid  should do what you want.

--- Marc Bernard <bernarduse1 at yahoo.fr> wrote:

> 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.
>



More information about the R-help mailing list