r - Dplyr difference between select and group_by with respect to quoted variables? -
in current version of dplyr, select
arguments can passed value:
variable <- "species" iris %>% select(variable) # species #1 setosa #2 setosa #3 setosa #4 setosa #5 setosa #6 setosa #...
but group_by
arguments cannot passed value:
iris %>% group_by(variable) %>% summarise(petal.length = mean(petal.length)) # error in grouped_df_impl(data, unname(vars), drop) : # column `variable` unknown
the documented dplyr::select behaviour
iris %>% select(species)
and documented documented dplyr::group_by behaviour
iris %>% group_by(species) %>% summarise(petal.length = mean(petal.length))
- why
select
,group_by
different respect passing arguments value? - why first
select
call working , continue work in future? - why first
group_by
call not working? i'm trying figure out combination ofquo()
,enquo()
,!!
should use make work.
i need because create function takes grouping variable input parameter, if possible grouping variable should given character string, because 2 other function parameters given character strings.
Comments
Post a Comment