From 4caa727dfef899e0cc61f466dcd85776758f4a73 Mon Sep 17 00:00:00 2001 From: Jan Marvin Garbuszus Date: Wed, 27 Dec 2023 02:25:57 +0100 Subject: [PATCH] =?UTF-8?q?[write]=20disable=20hyperlink=20check=20for=20m?= =?UTF-8?q?atrix=20otherwise=20vapply=20runs=20on=20e=E2=80=A6=20(#876)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [write] disable hyperlink check for matrix otherwise vapply runs on every cell instead of every column * update NEWS --- NEWS.md | 2 ++ R/write.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 1d05dc8b2..bf9ff97cb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,8 @@ * `wb_add_ignore_error()` now returns a `wbWorkbook` +* Deactivate the `is_hyperlink` check for non-dataframe objects in `wb_add_data()`. Internally, `vapply()` is applied to the input object, which is applied column-wise for a data frame and cell-wise for a matrix. This speeds up the writing of larger matrices considerably. [876](https://github.com/JanMarvin/openxlsx2/pull/876) + *************************************************************************** diff --git a/R/write.R b/R/write.R index b44259a1d..5161a7b51 100644 --- a/R/write.R +++ b/R/write.R @@ -759,7 +759,7 @@ write_data_table <- function( if (applyCellStyle) { if (is.null(dim(x))) { is_hyperlink <- inherits(x, "hyperlink") - } else { + } else if (is.data.frame(x)) { # dont check on a matrix is_hyperlink <- vapply(x, inherits, what = "hyperlink", FALSE) }