diff --git a/R/Apply.R b/R/Apply.R index 55afc40454f0be811e30207b700e2e89f3227af7..8ebdd4d3c822c8f0c6aca2c4a72c122423fbe085 100644 --- a/R/Apply.R +++ b/R/Apply.R @@ -285,7 +285,7 @@ Apply <- function(data, target_dims = NULL, fun, ..., "Please rename the elements to match the 'fun' argument names, ", "or provide an unnamed list in the expected order.") } - unnamed_elements <- which(names(data) == "") + unnamed_elements <- which(names(margins) == "") common_args <- fun_args[which(fun_args %in% names(margins))] common_args <- match(common_args, names(margins)) margins <- margins[c(common_args, unnamed_elements)] @@ -370,7 +370,7 @@ Apply <- function(data, target_dims = NULL, fun, ..., "Please rename the elements to match the 'fun' argument names, ", "or provide an unnamed list in the expected order.") } - unnamed_elements <- which(names(data) == "") + unnamed_elements <- which(names(target_dims) == "") common_args <- fun_args[which(fun_args %in% names(target_dims))] common_args <- match(common_args, names(target_dims)) target_dims <- target_dims[c(common_args, unnamed_elements)]