Re: [R] To transform a dataframe

2013-06-29 Thread arun
HI, Not sure why df2 didn't include Cat3, Debut3, Fin3, instead included columns with all missing values (Cat5, Debut5, Fin5). library(plyr) library(reshape2) df1New<-ddply(df1,.(Mat),transform,castCat=paste0("Cat",Cat),castDébut=paste0("Début",Cat),castFin=paste0("Fin",Cat)) res<- join_all(list

Re: [R] To transform a dataframe

2013-06-29 Thread Rui Barradas
Hello, The following does what you want but the order of columns is different. reshape(df1, v.names = c("Cat", "Début", "Fin"), idvar = "Mat", timevar = "Cat", direction = "wide") Hope this helps, Rui Barradas Em 29-06-2013 10:26, Arnaud Michel escreveu: Hello I would like to tran