-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
summarise_at does not correctly process select_helpers #2452
Comments
You forgot the |
But needs a better error message |
Hi, I've been playing around with the Assuming I have a database called The following two mutate_at(nhanes, vars(lbd1, lbd2), funs(mean(., na.rm = TRUE)))
mutate_at(nhanes, contains("lbd"), funs(mean(., na.rm = TRUE))) While the following two summarise_at(nhanes, vars(lbd1, lbd2), funs(mean(., na.rm = TRUE)))
summarise_at(nhanes, contains("lbd"), funs(mean(., na.rm = TRUE))) However, in both cases the i.e., both of these commands work identically, as anticipated: summarise_at(nhanes, vars(lbd1, lbd2), funs(mean))
summarise_at(nhanes, vars(lbd1, lbd2), funs(mean(.))) ... while only the first of these command works as anticipated: summarise_at(nhanes, contains("lbd"), funs(mean)) # Performs specified function on only vairable names containing "lbd"
summarise_at(nhanes, contains("lbd"), funs(mean(.))) # Performs specifed function on all variables! Ben |
If you want to use select style, you must use |
If this is the case... could someone please change the wording of the help file for
Ben |
Ah... just realised that you need to use the |
I'm currently using an NHANES data cut I've made to develop a teaching unit for people to learn to use dplyr for data manipulation. While doing so, I've noticed that the select_helpers do not work correctly for the summarise_at() function. For instance, the commands below return a data frame containing the mean of all variables, as opposed to just those specified by "contains" and "starts_with" helpers:
Whereas, what I want is akin to this, which does work, but is not as elegant:
Ben
The text was updated successfully, but these errors were encountered: