Re: [R] Puzzled at generating combinations

2008-03-19 Thread Petr PIKAL
Or he can use expand grid expand.grid(paste("r",1:3, sep=""), paste("R", 1:3, sep="")) Petr Pikal [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 18.03.2008 17:15:54: > > I have two data frames. Suppose the first has rows > > > > r1 > > r2 > > r3 > > > > and the second has rows > > > > R1 > >

Re: [R] Puzzled at generating combinations

2008-03-18 Thread John Kane
Will something like this work? x <- data.frame(xx=c("r1", "r2", "r3"), yy=c(1,2,3)) y <- data.frame(aa=c("R1", "R2", "R3"), bb=c(10,12, 14)) merge(x,y) --- Ajay Shah <[EMAIL PROTECTED]> wrote: > I have two data frames. Suppose the first has rows > > r1 > r2 > r3 > > and the second has rows >

Re: [R] Puzzled at generating combinations

2008-03-18 Thread Henrique Dallazuanna
Try: expand.grid(col2, col1) On 18/03/2008, Ajay Shah <[EMAIL PROTECTED]> wrote: > I have two data frames. Suppose the first has rows > > r1 > r2 > r3 > > and the second has rows > > R1 > R2 > R3 > > I'd like to generate the data frame: > >r1 R1 >r1 R2 >r1 R3 >r2 R1 >r

Re: [R] Puzzled at generating combinations

2008-03-18 Thread Richard . Cotton
> I have two data frames. Suppose the first has rows > > r1 > r2 > r3 > > and the second has rows > > R1 > R2 > R3 > > I'd like to generate the data frame: > > r1 R1 > r1 R2 > r1 R3 > r2 R1 > r2 R2 > r2 R3 > r3 R1 > r3 R2 > r3 R3 Try: col1

[R] Puzzled at generating combinations

2008-03-18 Thread Ajay Shah
I have two data frames. Suppose the first has rows r1 r2 r3 and the second has rows R1 R2 R3 I'd like to generate the data frame: r1 R1 r1 R2 r1 R3 r2 R1 r2 R2 r2 R3 r3 R1 r3 R2 r3 R3 How would I go about doing this? I'm sure there's a cle