sum r suumarize code example
Example 1: dplyr group by intervals of 3
d %>% mutate( ints = cut(v1 ,breaks = 11)) %>%
group_by(ints) %>%
summarise( mean.v2 = mean(v2) , mean.v3 = mean(v3) )
Example 2: r aggregate data frame by group
aggregate(x$Frequency, by=list(Category=x$Category), FUN=sum)
Category x
1 First 30
2 Second 5
3 Third 34