Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use select helpers inside group_by() #2818

Closed
jankislinger opened this issue May 24, 2017 · 2 comments
Closed

Use select helpers inside group_by() #2818

jankislinger opened this issue May 24, 2017 · 2 comments

Comments

@jankislinger
Copy link

It would be useful if group_by() function could take benefits from select helpers. Some dplyr functions (other than select) already work with these helpers (e.g. mutate_at).

require(dplyr, warn.conflicts = F, quietly = T)
df <- data_frame(g1 = rep(letters[1:3], 5), g2 = rep(letters[1:3], each = 5)) %>% 
  mutate(x = seq_len(n()), y = runif(n()))
group_by(df, starts_with("g"))
#> Error in mutate_impl(.data, dots): wrong result size (0), expected 15 or 1
@lionel-
Copy link
Member

lionel- commented May 24, 2017

That's out of scope for group_by() because it has mutate semantics, but we now have group_by_at() which allows what you want. See http://dplyr.tidyverse.org/articles/dplyr.html#patterns-of-operations for more information.

@lionel- lionel- closed this as completed May 24, 2017
@jankislinger
Copy link
Author

Thanks for fast response. I will check that

@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants