# Good max_by <- function(data, var, by) { data %>% group_by({{ by }}) %>% summarise(maximum = max({{ var }}, na.rm = TRUE)) } # Bad max_by <- function(data, var, by) { data %>% group_by({{by}}) %>% summarise(maximum = max({{var}}, na.rm = TRUE)) }