I'm rather new to (d)plyr and want to focus on learning the more recent package. However, I failed to translate something like the following to dplyr:
library(plyr)
#library(dplyr)
dfx <- data.frame(
group = c(rep('A', 8), rep('B', 15), rep('C', 6)),
sex = sample(c("M", "F"), size = 29, replace = TRUE),
age = runif(n = 29, min = 18, max = 54)
)
p <- c(.2,.4,.6,.8)
ddply(dfx, .(group), .fun = summarize, p=p, stats=quantile(age,probs=p))
# dfx %>% group_by(group) %>% do(stats=quantile(.$age, probs=p))
The commented lines show what I found working with dplyr. Here, the data structure is more complicated, though. (Don't load dplyr package to have ddply working.)