hadley / r4ds

R for data science: a book
http://r4ds.hadley.nz
Other
4.59k stars 4.22k forks source link

Tidyselect operations `!` and `-` are subtly different #1598

Closed lionel- closed 1 year ago

lionel- commented 1 year ago

Closes https://github.com/tidyverse/dplyr/issues/6959

dholstius commented 11 months ago

Here's an example of a not-so-subtle difference? The final line silently declines to return foo at all.

select(mtcars, foo = cyl)  # result omits unnamed columns
select(mtcars, foo = cyl, !cyl)  # result includes unnamed columns
select(mtcars, foo = cyl, everything(), -cyl)  # result includes all columns except cyl (and foo)