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

Reorganize 'Selecting variables' section #61

Closed
wants to merge 1 commit into from
Closed

Reorganize 'Selecting variables' section #61

wants to merge 1 commit into from

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Apr 2, 2019

Perhaps the motivation becomes more apparent when explained by the obsolescence of vars() and then extending this to functions that use dots for selection.

@krlmlr
Copy link
Member Author

krlmlr commented May 6, 2019

@hadley: Would you like to review? I can't request a review (no permissions?)

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is only extending an existing section, but this extension now makes it clearer to me that we might be getting ahead of ourselves by writing this out in principles. I fully support the new tidyr UI, but it isn't released yet. It feels too early to me to draw general conclusions about vars() vs enquo(). I think we're still missing things about quoting vs regular eval, and about selections vs actions. In general, this discussion is missing one entire goal of the colwise functions when we designed them: they were meant to use standard eval, as they were a bridge between purrr and dplyr. Similarly facet_grid() and facet_wrap() are standard eval functions, so taking vars() was an obvious fit.

When we rewrite the colwise verbs with automatic splicing, one possibility is to have a mapping() function that enquo() a selection. That would be consistent with the new tidyr UI. Another possibility is to compose with pick() and tibble() to take selections and actions. Perhaps we'll have both, the latter being more advanced and requiring knowledge of purrr::map_df(). In any case, pick() will be a new way of interacting with the data mask (creating a tibble based on dynamically scoped variables).

I guess my point is that it might be too early to write about this in the principles book because we're still figuring things out. Should we have a place where we can develop working documents instead? Ideally these would not be fully fleshed out so that they retain a "still in progress" feel conducive to exploration.

ggplot2::facet_grid(rows = drv, cols = c(vs, am))
```

The `vars()` function is a simple wrapper around `quos()`, and adds no value compared to using `c()` directly, which requires quoting by the called function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say it adds no value. It can be useful to take selections in standard eval functions.

@jennybc jennybc deleted the branch tidyverse:master October 27, 2021 22:57
@jennybc jennybc closed this Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants