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

re-export where from tidyselect? #5725

Closed
IndrajeetPatil opened this issue Feb 3, 2021 · 2 comments
Closed

re-export where from tidyselect? #5725

IndrajeetPatil opened this issue Feb 3, 2021 · 2 comments

Comments

@IndrajeetPatil
Copy link
Contributor

For example, in the following example, the function correctly recommends me to use where.

library(dplyr, warn.conflicts = FALSE)

as_tibble(iris) %>% filter(if_all(is.numeric, ~ !is.na(.)))
#> Warning: Predicate functions must be wrapped in `where()`.
#> 
#>   # Bad
#>   data %>% select(is.numeric)
#> 
#>   # Good
#>   data %>% select(where(is.numeric))
#> 
#> ℹ Please update your code.
#> This message is displayed once per session.
#> # A tibble: 150 x 5
#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#>           <dbl>       <dbl>        <dbl>       <dbl> <fct>  
#>  1          5.1         3.5          1.4         0.2 setosa 
#>  2          4.9         3            1.4         0.2 setosa 
#>  3          4.7         3.2          1.3         0.2 setosa 
#>  4          4.6         3.1          1.5         0.2 setosa 
#>  5          5           3.6          1.4         0.2 setosa 
#>  6          5.4         3.9          1.7         0.4 setosa 
#>  7          4.6         3.4          1.4         0.3 setosa 
#>  8          5           3.4          1.5         0.2 setosa 
#>  9          4.4         2.9          1.4         0.2 setosa 
#> 10          4.9         3.1          1.5         0.1 setosa 
#> # … with 140 more rows

As a user, this is straightforward.

But, in the context of a package function, this adds a new tidyselect dependency since where is currently not re-exported from dplyr.

as_tibble(iris) %>% filter(if_all(where(is.numeric), ~ !is.na(.)))
#> # A tibble: 150 x 5
#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#>           <dbl>       <dbl>        <dbl>       <dbl> <fct>  
#>  1          5.1         3.5          1.4         0.2 setosa 
#>  2          4.9         3            1.4         0.2 setosa 
#>  3          4.7         3.2          1.3         0.2 setosa 
#>  4          4.6         3.1          1.5         0.2 setosa 
#>  5          5           3.6          1.4         0.2 setosa 
#>  6          5.4         3.9          1.7         0.4 setosa 
#>  7          4.6         3.4          1.4         0.3 setosa 
#>  8          5           3.4          1.5         0.2 setosa 
#>  9          4.4         2.9          1.4         0.2 setosa 
#> 10          4.9         3.1          1.5         0.1 setosa 
#> # … with 140 more rows

To appease _R_CHECK_EXCESSIVE_IMPORTS_ check from CRAN, I'd prefer if dplyr re-exports this function, so that one doesn't have to add both dplyr and tidyselect to Imports.

@yutannihilation
Copy link
Member

It's not experted from tidyselect. See r-lib/tidyselect#201

@IndrajeetPatil
Copy link
Contributor Author

IndrajeetPatil commented Feb 3, 2021

Oh, strange that it is not exported from tidyselect. I just assumed it was since I saw it on the website:
https://tidyselect.r-lib.org/reference/where.html

Okay, then closing this issue in favour of r-lib/tidyselect#201 (although the issues are slightly different as here the where function will need to be re-exported).

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

No branches or pull requests

2 participants