Skip to content
Prev 279299 / 398503 Next

Group several variables and apply a function to the group

?aggregate should do it

aggregate(df$x,list(df$comn, df$mi), sd)

There are other ways of course

Using the reshape2 package 

library(reshape2)
x1 <- melt(df, id=c("comn", "mi"))
dcast(x1, comn + mi ~ variable, sd)
--- On Sun, 12/4/11, Aur?lien PHILIPPOT <aurelien.philippot at gmail.com> wrote: