Found out that this works in dplyr 0.7.4:
library(dplyr) x <- data_frame(name = c("a", "b"), type = c("integer", "string")) x %>% group_by(name) %>% select(name) %>% setdiff(select(x, name)) %>% left_join(x, by = "name")
# A tibble: 0 x 2
# Groups: [?]
# ... with 2 variables: name <chr>, type <chr>
but not in dplyr 0.7.5:
Error in grouped_df_impl(out, vars$alias[groups_in_alias], group_drop(x), :
no variables to group by
We found and pushed a fix for sparklyr with sparklyr/sparklyr#1510, but reporting to consider fixing upstream.