Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
Sorry, you don't need 'melt' : cast(truc, Subject ~ Quarter) 2009/2/19 David Hajage > "And I would like to group the Subject by Quarter using as a result in the > table the value of the third variable (Boolean). The final result would > give: > > Subjet Q1 Q2 Q3 Q4 > 1100 Y Y Y Y > 2

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
"And I would like to group the Subject by Quarter using as a result in the table the value of the third variable (Boolean). The final result would give: Subjet Q1 Q2 Q3 Q4 1100 Y Y Y Y 2101 N N N N" Are you sure that this is the final result you want ? You could use the reshape

Re: [R] table with 3 variables

2009-02-19 Thread Eik Vettorazzi
Maybe reshape will help you, but I'm in doubt that your posted desired result fits your given data - e.g shouldn't subject 101 Q3 give "Y"? xx<-data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste("Q",1:4,sep=""),2), Boolean = rep(c("Y","N"),4)) reshape(xx,timevar="Quarter",idvar="Subje