I'm rewriting some Code in a Project where I need to group by (and summarise) a variablename from a character variable, similar to this:
test <- mtcars
x <- "gear"
This would work with group_by_
the deprecated standard evaluation version of group_by
like this:
test %>%
group_by_(x) %>%
summarise(mpg=mean(mpg)
Is it possible to archive this with group_by
and quoting and unqouting x
or can I use selection helpers like matches
in group_by
?
I cannot change the way x
is stored, because other parts of the project still use split-lapply like split(test, test[, x])
...