Re: [R] sequence of vectors

2007-11-19 Thread Gregory Warnes
Well, this is a natural thing to program up using 3 nested 'for', loops. Alternatively, one could use something like: > combn <- function( ..., l=list(...) ) + { + lens <- sapply( args, length) + ncomb <- prod(lens) + retval <- matrix(ncol=length(args), nrow=ncomb) + for(i in 1:leng

Re: [R] sequence of vectors

2007-11-19 Thread ONKELINX, Thierry
] 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 an

Re: [R] sequence of vectors

2007-11-19 Thread Dimitris Rizopoulos
://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Marc Bernard" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 19, 2007 3:59 PM Subject: [R] sequence of vectors > Dear All, > > I wonder if there is any R fun

Re: [R] sequence of vectors

2007-11-19 Thread John Kane
?expand.grid should do what you want. --- Marc Bernard <[EMAIL PROTECTED]> 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

[R] sequence of vectors

2007-11-19 Thread Marc Bernard
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 i