I\'m very new to R. Trying to define a function that groups a data set (group_by) and then creates summary statistics based on the groupings (dplyr, summarise_each).
Wi
This is the usual way you'd do this:
foo <- function(data,column){ data %>% group_by_(.dots = column) %>% summarise_each(funs(mean)) } foo(mtcars,"cyl") foo(mtcars,"gear")