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

tolerate unknown vars in one_of() #1848

Merged
merged 1 commit into from
May 26, 2016
Merged

tolerate unknown vars in one_of() #1848

merged 1 commit into from
May 26, 2016

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented May 22, 2016

I want to say "if variable x is present, keep it; but don't worry if it's not" inside dplyr::select(). I have a pipeline where a certain variable will be there sometimes but not others.

select(head(iris, 3), one_of(c("Sepal.Length", "Stem.Length")))
#>   Sepal.Length
#> 1          5.1
#> 2          4.9
#> 3          4.7
#> Warning message:
#> In one_of(c("Sepal.Length", "Stem.Length")) :
#>   Unknown variables: `Stem.Length`

@hadley
Copy link
Member

hadley commented May 26, 2016

Looks good. Could you please also add a bullet to NEWS.md?

@jennybc
Copy link
Member Author

jennybc commented May 26, 2016

Bullet added.

@@ -9,6 +9,8 @@

* enabling joining of data frames that don't have the same encoding of
column names (#1513).

* `one_of()` tolerates unknown variables in `vars`, but warns (#1848).
Copy link
Member

Choose a reason for hiding this comment

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

One more tiny nitpick - can you please include @jennybc in the brackets

Copy link
Member Author

Choose a reason for hiding this comment

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

Bullet owned.

@hadley hadley merged commit f796070 into tidyverse:master May 26, 2016
@hadley
Copy link
Member

hadley commented May 26, 2016

Thanks!

@jennybc jennybc deleted the relax-one-of branch May 27, 2016 23:01
@lock
Copy link

lock bot commented Jan 18, 2019

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

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants