Skip to content

Commit

Permalink
Remove not needed new_expanded_quosures() (#7090)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan authored Oct 1, 2024
1 parent 1d17672 commit e4e9a29
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions R/across.R
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ expand_across <- function(quo) {

# Empty expansion
if (length(vars) == 0L) {
return(new_expanded_quosures(list()))
return(list())
}

fns <- setup$fns
Expand All @@ -767,7 +767,7 @@ expand_across <- function(quo) {
# No functions, so just return a list of symbols
if (is.null(fns)) {
# TODO: Deprecate and remove the `.fns = NULL` path in favor of `pick()`
expressions <- pmap(list(vars, names, seq_along(vars)), function(var, name, k) {
exprs <- pmap(list(vars, names, seq_along(vars)), function(var, name, k) {
quo <- new_quosure(sym(var), empty_env())
quo <- new_dplyr_quosure(
quo,
Expand All @@ -777,9 +777,8 @@ expand_across <- function(quo) {
column = var
)
})
names(expressions) <- names
expressions <- new_expanded_quosures(expressions)
return(expressions)
names(exprs) <- names
return(exprs)
}

n_vars <- length(vars)
Expand All @@ -788,8 +787,7 @@ expand_across <- function(quo) {
seq_vars <- seq_len(n_vars)
seq_fns <- seq_len(n_fns)

expressions <- vector(mode = "list", n_vars * n_fns)
columns <- character(n_vars * n_fns)
exprs <- new_list(n_vars * n_fns, names = names)

k <- 1L
for (i in seq_vars) {
Expand All @@ -799,7 +797,7 @@ expand_across <- function(quo) {
fn_call <- as_across_fn_call(fns[[j]], var, env, mask)

name <- names[[k]]
expressions[[k]] <- new_dplyr_quosure(
exprs[[k]] <- new_dplyr_quosure(
fn_call,
name = name,
is_named = TRUE,
Expand All @@ -811,12 +809,7 @@ expand_across <- function(quo) {
}
}

names(expressions) <- names
new_expanded_quosures(expressions)
}

new_expanded_quosures <- function(x) {
structure(x, class = "dplyr_expanded_quosures")
exprs
}

as_across_fn_call <- function(fn, var, env, mask) {
Expand Down

0 comments on commit e4e9a29

Please sign in to comment.