df <- data.frame(sex = rep(c("male", "female"), each = 5),
obs = rpois(10, rep(7,5, each=5)),
pyrs = rpois(10, lambda = 10000))
setaggre(df, values = c("obs", "pyrs"), by = "sex")
Run the code above in your browser using DataLab