I am relatively new to R, and trying to use ddply & summarise from the plyr package. This post almost, but not quite, answers my question. I could use some additional ex
I just moved a couple things around in the example function you gave and showed how to get more than one column back out. Does this do what you want?
myFunction2 <- function(x, y, col){
z <- ddply(x, y, .fun = function(xx){
c(mean = mean(xx[,col],na.rm=TRUE),
max = max(xx[,col],na.rm=TRUE) ) })
return(z)
}
myFunction2(mtcars, "cyl", "hp")