Skip to content

vars_pull() should warn on external vectors #377

@DavisVaughan

Description

@DavisVaughan

Alternative solution would be to implement eval_pull() and deprecate vars_pull() #189

Here vars_pull() and eval_select() are consistent but only eval_select() warns.

I think vars_pull() should warn too, or we should develop a new eval_pull() and use that instead and fix all these minor issues

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, union

d <- data.frame(x = "ex", y = "why")
x <- "y"

pull(d, x)
#> [1] "ex"
select(d, x)
#>    x
#> 1 ex

# Now remove x
d <- select(d, -x)

pull(d, x)
#> [1] "why"
select(d, x)
#> 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(x)
#> 
#>   # Now:
#>   data %>% select(all_of(x))
#> 
#> See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#>     y
#> 1 why

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions