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 tidyeval functionality #17

Closed
mine-cetinkaya-rundel opened this issue Jun 28, 2017 · 5 comments
Closed

Use tidyeval functionality #17

mine-cetinkaya-rundel opened this issue Jun 28, 2017 · 5 comments

Comments

@mine-cetinkaya-rundel
Copy link
Collaborator

This is relevant to calculate but maybe others too, if any of those use underscore verbs from dplyr, which is now deprecated functionality.

Prototype for calculating for stat == "mean"

  if (stat == "mean") {
    col <- setdiff(names(x), "replicate")
    x %>%
      dplyr::group_by(replicate) %>%
      dplyr::summarize(stat = mean(!!sym(col)))
  }

Note that this requires importing the sym function from the rlang package, which dplyr currently does not import automatically.

Is someone up for updating the calculate function with this, or should I? We also need to resolve #15 and #16 to and all of the updates can be done at once.

@andrewpbray
Copy link
Collaborator

I'll do this. Will give me a chance to play around with this new formulation.

@ismayc
Copy link
Collaborator

ismayc commented Jul 3, 2017

Is there a way to have the stat in dplyr::summarize(stat = mean(!!sym(col))) be variable based on the statistic chosen using the tidyeval/rlang syntax? Having the column be named stat does work but I wonder about students being confused/forgetting, what the statistic was that they calculated.

@rpruim
Copy link

rpruim commented Jul 3, 2017

Follow with %>% rename()?

@ismayc
Copy link
Collaborator

ismayc commented Nov 1, 2017

@andrewpbray Can this be closed?

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2021
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

4 participants