You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#> Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.#> ℹ Please use `all_of()` or `any_of()` instead.#> # Was:#> data %>% select(old)#> #> # Now:#> data %>% select(all_of(old))
I've had difficulty determining it's origin, but it seems to be due to the pattern dplyr::rename(df, !!new := old) when new and old are chr function arguments. This should instead be dplyr::rename(df, !!new := {{ old }}) to silence the warning.
fun<-function(df, new, old) {
dplyr::rename(df, !!new:=old)
}
fun1<-function(df, new, old) {
dplyr::rename(df, !!new:= {{ old }})
}
options(lifecycle_verbosity="warning") # forces the warning to happen everytimetib<-tibble::tibble(x=1:5, y=1:5)
fun(tib, "z", "y")
#> Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.#> ℹ Please use `all_of()` or `any_of()` instead.#> # Was:#> data %>% select(old)#> #> # Now:#> data %>% select(all_of(old))#> #> See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was#> generated.#> # A tibble: 5 × 2#> x z#> <int> <int>#> 1 1 1#> 2 2 2#> 3 3 3#> 4 4 4#> 5 5 5
fun1(tib, "z", "y")
#> # A tibble: 5 × 2#> x z#> <int> <int>#> 1 1 1#> 2 2 2#> 3 3 3#> 4 4 4#> 5 5 5
This warning happens intermittently:
I've had difficulty determining it's origin, but it seems to be due to the pattern
dplyr::rename(df, !!new := old)
whennew
andold
are chr function arguments. This should instead bedplyr::rename(df, !!new := {{ old }})
to silence the warning.Created on 2023-05-07 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: