Skip to content

Commit 6c2c886

Browse files
committed
Use vec_pany() and vec_pall()
1 parent 2340528 commit 6c2c886

File tree

1 file changed

+2
-50
lines changed

1 file changed

+2
-50
lines changed

R/across.R

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ dplyr_list_pall <- function(
372372
size = NULL,
373373
error_call = caller_env()
374374
) {
375-
dplyr_list_pany_pall(x, "all", ..., size = size, error_call = error_call)
375+
vec_pall(!!!x, .size = size, .error_call = error_call)
376376
}
377377

378378
dplyr_list_pany <- function(
@@ -381,55 +381,7 @@ dplyr_list_pany <- function(
381381
size = NULL,
382382
error_call = caller_env()
383383
) {
384-
dplyr_list_pany_pall(x, "any", ..., size = size, error_call = error_call)
385-
}
386-
387-
dplyr_list_pany_pall <- function(
388-
x,
389-
variant,
390-
...,
391-
size = NULL,
392-
error_call = caller_env()
393-
) {
394-
check_dots_empty0(...)
395-
396-
obj_check_list(x, arg = "", call = error_call)
397-
398-
# Doesn't allow `NULL`, doesn't do type casting
399-
for (i in seq_along(x)) {
400-
check_logical(
401-
x[[i]],
402-
arg = (vec_names(x) %||% paste0("..", seq_len(vec_size(x))))[[i]],
403-
call = error_call
404-
)
405-
}
406-
407-
# Doesn't do recycling, asserts that all inputs are the same size
408-
if (is.null(size)) {
409-
if (length(x) == 0L) {
410-
size <- 0L
411-
} else {
412-
size <- vec_size(x[[1L]])
413-
}
414-
}
415-
list_check_all_size(x, size, arg = "", call = error_call)
416-
417-
switch(
418-
variant,
419-
any = {
420-
op <- `|`
421-
init <- FALSE
422-
},
423-
all = {
424-
op <- `&`
425-
init <- TRUE
426-
},
427-
abort("Unreachable", .internal = TRUE)
428-
)
429-
430-
init <- vec_rep(init, times = size)
431-
432-
reduce(x, op, .init = init)
384+
vec_pany(!!!x, .size = size, .error_call = error_call)
433385
}
434386

435387
#' Combine values from multiple columns

0 commit comments

Comments
 (0)