I am having trouble understanding the use of the plyr package. I am trying to use it to separate the data that is stored in a list, apply the function, save the results as data files and merge the data again as a list. Therefore, given the following data:
df1<-data.frame(a=sample(1:50,10),b=sample(1:50,10),c=sample(1:50,10),d=(c("a","b","c","a","a","b","b","a","c","d")))
df2<-data.frame(a=sample(1:50,9),b=sample(1:50,9),c=sample(1:50,9),d=(c("e","f","g","e","e","f","f","e","g")))
df3<-data.frame(a=sample(1:50,8),b=sample(1:50,8),c=sample(1:50,8),d=(c("h","i","j","h","h","i","i","h")))
list.1<-list(df1=df1,df2=df2,df3=df3)
I would like to calculate the average value for each group defined in d of each data frame. If I used plyr on only one data frame (to calculate the average value for a specific column by groups), then the ability to use the plyr package would be:
ddply(df1,.(d),summarise, mean=mean(a))
? reassamble , matrizes cotaining ? , R, ... .