From b0e10448b0556a8bf6cd8e72c6795bf1ff906062 Mon Sep 17 00:00:00 2001 From: Michael Chirico <chiricom@google.com> Date: Fri, 13 Sep 2024 17:37:06 +0000 Subject: [PATCH] try do.call(c, ans) instead of unlist() --- src/library/base/R/tapply.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/base/R/tapply.R b/src/library/base/R/tapply.R index 47ac215845b..43712236d76 100644 --- a/src/library/base/R/tapply.R +++ b/src/library/base/R/tapply.R @@ -50,7 +50,7 @@ tapply <- function (X, INDEX, FUN = NULL, ..., default = NA, simplify = TRUE) ans <- lapply(X = ans[index], FUN = FUN, ...) ansmat <- array( if (simplify && all(lengths(ans) == 1L)) { - ans <- unlist(ans, recursive = FALSE, use.names = FALSE) + ans <- do.call(c, ans) if(is.na(default) && is.atomic(ans)) vector(typeof(ans)) else default