From f009b9a756157b0ae7fa291caefc4dc7da1ea568 Mon Sep 17 00:00:00 2001 From: Friedrich Pahlke Date: Tue, 17 Dec 2024 10:58:18 +0100 Subject: [PATCH 1/2] Issue #68 fixed --- NEWS.md | 1 + R/class_summary.R | 5 +---- R/f_core_utilities.R | 12 +++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index be64804..89c1c1e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,7 @@ * Usage of `maxInformation` improved (see enhancement [#65](https://github.com/rpact-com/rpact/issues/65)) * `testPackage()`: additional warning details will be added to the test report if warnings exist * Issue [#61](https://github.com/rpact-com/rpact/issues/61)) fixed +* Issue [#68](https://github.com/rpact-com/rpact/issues/68)) fixed * Flexibility of function `getPiecewiseSurvivalTime()` improved * Test coverage improved * Minor improvements diff --git a/R/class_summary.R b/R/class_summary.R index bc640ca..cc3cb6d 100644 --- a/R/class_summary.R +++ b/R/class_summary.R @@ -140,9 +140,7 @@ plot.SummaryFactory <- function(x, y, ..., showSummary = FALSE) { } .knitPrintQueue <- function(x, ..., sep = NA_character_, prefix = "") { - on.exit({ - attr(x, "queue") <- NULL - }) + on.exit(.resetPipeOperatorQueue(x)) result <- character() if (inherits(x, "SummaryFactory")) { queue <- attr(x$object, "queue") @@ -234,7 +232,6 @@ print.SummaryFactory <- function(x, ..., } queue[[length(queue) + 1]] <- x$object attr(x$object, "queue") <- queue - return(.knitPrintQueue(x, sep = sep)) } diff --git a/R/f_core_utilities.R b/R/f_core_utilities.R index ac52ee6..5f825c7 100644 --- a/R/f_core_utilities.R +++ b/R/f_core_utilities.R @@ -1598,7 +1598,17 @@ getParameterName <- function(obj, parameterCaption) { } .resetPipeOperatorQueue <- function(x) { - attr(x, "queue") <- NULL + for (attrName in c("queue", "printObject", "printObjectSeparator")) { + tryCatch({ + if (inherits(x, "SummaryFactory")) { + attr(x$object, attrName) <- NULL + } else { + attr(x, attrName) <- NULL + } + }, error = function(e) { + message("Failed to reset pipe operator queue attribute ", sQuote(attrName), ": ", e$message) + }) + } return(x) } From 0ffb5678a4252f8f52fc4875e52a4974b0c61312 Mon Sep 17 00:00:00 2001 From: Friedrich Pahlke Date: Tue, 17 Dec 2024 10:59:08 +0100 Subject: [PATCH 2/2] NEWS updated --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 89c1c1e..389cef5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,8 +15,8 @@ For more information, please visit: [rpact.org/iq](www.rpact.org/iq) * Usage of `maxInformation` improved (see enhancement [#65](https://github.com/rpact-com/rpact/issues/65)) * `testPackage()`: additional warning details will be added to the test report if warnings exist -* Issue [#61](https://github.com/rpact-com/rpact/issues/61)) fixed -* Issue [#68](https://github.com/rpact-com/rpact/issues/68)) fixed +* Issue [#61](https://github.com/rpact-com/rpact/issues/61) fixed +* Issue [#68](https://github.com/rpact-com/rpact/issues/68) fixed * Flexibility of function `getPiecewiseSurvivalTime()` improved * Test coverage improved * Minor improvements