R/central_measures.R

Defines functions central_measures

central_measures <- function(df, x_var, group_var) {
  
  x_var <- enquo(x_var)
  group_var <- enquo(group_var)
  
  df %>% 
    group_by(!! group_var) %>% 
    summarize(med = median(!! x_var, na.rm = T),
              avg = mean(!! x_var, na.rm = T)) %>% 
    ungroup()
}
mohrsignal/edat documentation built on May 18, 2019, 3:38 a.m.