How do I change the name of the grouping variable in dplyr::count_
when it's used in a standard evaluation way
For example if in the final tbl I don't want the var name "Species" but "Type" :
iris %>%
group_by("Species") %>%
count_("Species")
Source: local data frame [3 x 2]
Species n
1 setosa 50
2 versicolor 50
3 virginica 50
Also I wonder how dplyr::count_
works and what this expression is supposed to do ? Do you have an explanation ?
> iris %>% group_by("Species") %>% count_("x = Species")
Source: local data frame [3 x 2]
x = Species n
1 setosa 50
2 versicolor 50
3 virginica 50
Thanks !
Well, I used setNames
before posting but in a wrong way.
It seems to be the solution :
count_(iris, setNames("Species", "type"))