(I'm currently using the development version of dplyr 1.0.0 a.k.a. 0.8.99.9002)
With dplyr 1.0.0, I understand across() should supersede all scoped verbs, and the scoped select_all documentation now says "select_if() and rename_if() already use tidy selection so they can't be replaced by across() and instead we need a new function."
But when trying to use a purrr-style function with select(), I get an error, which otherwise works with the (now-deprecated) select_if().
Thanks -- here's a reprex!
library(dplyr)
#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, uniondf<- tibble(x= c(1,2,3), y= c(4,5,NA),
z= c(NA, NA, NA), a= c("1", "2", "3"))
select(df, is.numeric| contains("a"))
#> # A tibble: 3 x 3#> x y a #> <dbl> <dbl> <chr>#> 1 1 4 1 #> 2 2 5 2 #> 3 3 NA 3
select(df, ~!all(is.na(.)))
#> Error: Must subset columns with a valid subscript vector.#> x Subscript has the wrong type `formula`.#> ℹ It must be numeric or character.
select_if(df, ~!all(is.na(.)))
#> # A tibble: 3 x 3#> x y a #> <dbl> <dbl> <chr>#> 1 1 4 1 #> 2 2 5 2 #> 3 3 NA 3
library(tidyselect)
library(rlang)
tidyselect::eval_select(expr(is.numeric), mtcars)
#> mpg cyl disp hp drat wt qsec vs am gear carb #> 1 2 3 4 5 6 7 8 9 10 11tidyselect::eval_select(expr(~is.numeric(.)), mtcars)
#> Error: Must subset columns with a valid subscript vector.#> x Subscript has the wrong type `formula`.#> ℹ It must be numeric or character.
(I'm currently using the development version of dplyr 1.0.0 a.k.a. 0.8.99.9002)
With dplyr 1.0.0, I understand
across()should supersede all scoped verbs, and the scoped select_all documentation now says "select_if() and rename_if() already use tidy selection so they can't be replaced by across() and instead we need a new function."But when trying to use a purrr-style function with
select(), I get an error, which otherwise works with the (now-deprecated)select_if().Thanks -- here's a reprex!
Created on 2020-04-17 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: