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
"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
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
3 matches
Mail list logo