Non-syntactic names in select + group_by #1138
Should dplyr support non-syntactic (backtick-required) names for columns?
Minimal reproducible example:
> data_frame(`a b`=2) %>% group_by(`a b`) %>% select Error: invalid column index : NA for variable: `a b` = `a b`
The problem seems to be in select_.grouped_df. In particular, it's tripping over the following funny interaction between non-syntactic names / lists /
> x <- quote(`a b`) > as.character(x) ## no backticks  "a b" > as.character(list(x)) ## backticks  "`a b`" > y <- quote(`ab`) > as.character(y)  "ab" > as.character(list(y))  "ab"
Because of the additional backticks, not all elements of
vars <- select_vars_(names(.data), dots, include = unlist(lapply(groups(.data), as.character)))
appears to fix the problem.
The text was updated successfully, but these errors were encountered: