Skip to content

Commit

Permalink
tidyselect for col_exists(); resolves #433
Browse files Browse the repository at this point in the history
  • Loading branch information
yjunechoe committed Oct 23, 2023
1 parent 7b8c66c commit 2255b41
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions R/col_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,14 @@ col_exists <- function(
rlang::as_label(rlang::quo(!!enquo(columns))) %>%
gsub("^\"|\"$", "", .)

# Normalize the `columns` expression
if (inherits(columns, "quosures")) {

columns <-
vapply(
columns,
FUN.VALUE = character(1),
USE.NAMES = FALSE,
FUN = function(x) as.character(rlang::get_expr(x))
)
# Capture the `columns` expression
columns <- rlang::enquo(columns)
if (rlang::quo_is_null(columns)) {
columns <- rlang::quo(tidyselect::everything())
}

# Resolve the columns based on the expression
columns <- resolve_columns(x = x, var_expr = columns, preconditions = NULL)

if (is_a_table_object(x)) {

Expand Down

0 comments on commit 2255b41

Please sign in to comment.