From 662b12164fd75de6344728d61d5cb091be691b40 Mon Sep 17 00:00:00 2001 From: markfairbanks Date: Sat, 21 Oct 2023 02:37:08 -0600 Subject: [PATCH 1/2] Remove check for `across.()` --- R/mutate.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/mutate.R b/R/mutate.R index e9826574..a42fcd0c 100644 --- a/R/mutate.R +++ b/R/mutate.R @@ -89,7 +89,7 @@ mutate.tidytable <- function(.df, ..., .by = NULL, one_dot <- length(dots) == 1 if (!one_dot) { - is_across <- map_lgl(dots[-1], quo_is_call, c("across.", "across")) + is_across <- map_lgl(dots[-1], quo_is_call, "across") if (any(is_across)) { # tidyselect helpers will miss columns made before an across call # that is not in the first position From ef4ab8e017b4967b997584a7057275905789ea69 Mon Sep 17 00:00:00 2001 From: markfairbanks Date: Sat, 21 Oct 2023 02:37:35 -0600 Subject: [PATCH 2/2] Simplify `check_no_across()` --- R/distinct.R | 2 +- R/group_by.R | 2 +- R/utils-general.R | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/R/distinct.R b/R/distinct.R index cf252545..618eaf96 100644 --- a/R/distinct.R +++ b/R/distinct.R @@ -32,7 +32,7 @@ distinct <- function(.df, ..., .keep_all = FALSE) { distinct.tidytable <- function(.df, ..., .keep_all = FALSE) { dots <- enquos(...) - check_across(dots, "distinct") + check_no_across(dots) if (length(dots) == 0) { out <- vec_unique(.df) diff --git a/R/group_by.R b/R/group_by.R index 8fc3e568..bb60be37 100644 --- a/R/group_by.R +++ b/R/group_by.R @@ -35,7 +35,7 @@ group_by <- function(.df, ..., .add = FALSE) { #' @export group_by.tidytable <- function(.df, ..., .add = FALSE) { dots <- enquos(...) - check_across(dots, "group_by") + check_no_across(dots) .groups <- tidyselect_names(.df, !!!dots) if (length(.groups) == 0) { out <- .df diff --git a/R/utils-general.R b/R/utils-general.R index 1716171f..bbf20bae 100644 --- a/R/utils-general.R +++ b/R/utils-general.R @@ -177,10 +177,11 @@ vec_ptype_compatible <- function(x, y) { tryCatch({vec_ptype_common(x, y); TRUE}, error = function(e) FALSE) } -check_across <- function(dots, .fn) { - uses_across <- any(map_lgl(dots, quo_is_call, c("across", "across.", "pick"))) - - if (uses_across) { +check_no_across <- function(dots) { + any_across <- any(map_lgl(dots, quo_is_call, c("across", "pick"))) + if (any_across) { + .fn <- as.character(caller_call()[[1]]) + .fn <- str_replace(.fn, ".tidytable", "") msg <- glue("`across()`/`pick()` are unnecessary in `{.fn}()`. Please directly use tidyselect. Ex: df %>% {.fn}(where(is.numeric))")