Re: [R] Group by multiple variables

2011-05-30 Thread Sebastian P. Luque
On Mon, 30 May 2011 16:47:45 -0500, "Mendolia, Franco" wrote: > Hello, I would like to create a group variable that is based on the > values of three variables: > For example, >> dat <- data.frame(A=c(1,1,1,1,1,2,2,2,2,2), > B=c(1,1,1,5,5,5,9,9,9,9), > C=c(1,1,1,1,1,2,2,7,7,

Re: [R] Group by multiple variables

2011-05-30 Thread baptiste auguie
Hi, There are probably much better ways, but try this transform(dat, group = as.numeric(factor(paste(A,B,C, sep="" HTH, baptiste On 31 May 2011 09:47, Mendolia, Franco wrote: > Hello, > > I would like to create a group variable that is based on the values of three > variables: > > For ex

[R] Group by multiple variables

2011-05-30 Thread Mendolia, Franco
Hello, I would like to create a group variable that is based on the values of three variables: For example, > dat <- data.frame(A=c(1,1,1,1,1,2,2,2,2,2), B=c(1,1,1,5,5,5,9,9,9,9), C=c(1,1,1,1,1,2,2,7,7,7)) > dat A B C 1 1 1 1 2 1 1 1 3 1 1 1 4