From 733fb7583e09de0921bd83b19257813c38234bff Mon Sep 17 00:00:00 2001 From: John Blischak Date: Wed, 25 Sep 2024 11:09:21 -0400 Subject: [PATCH] Redirect as_gt() to gsDesign2 when it is masked by simtrial::as_gt() --- NAMESPACE | 2 ++ R/as_gt.R | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 23fdda0c..6a2a608b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,7 @@ # Generated by roxygen2: do not edit by hand +S3method(as_gt,fixed_design) +S3method(as_gt,gs_design) S3method(as_gt,simtrial_gs_wlr) S3method(summary,simtrial_gs_wlr) S3method(wlr,counting_process) diff --git a/R/as_gt.R b/R/as_gt.R index dcadf9ce..584915b8 100644 --- a/R/as_gt.R +++ b/R/as_gt.R @@ -142,3 +142,16 @@ as_gt.simtrial_gs_wlr <- function(x, gt::tab_header(title = title, subtitle = subtitle) } } + +# Only purpose of the methods below is to fix S3 redirection when simtrial is +# loaded after gsDesign2, which masks the as_gt() generic from gsDesign2 + +#' @export +as_gt.fixed_design <- function(x, ...) { + gsDesign2:::as_gt.fixed_design(x, ...) +} + +#' @export +as_gt.gs_design <- function(x, ...) { + gsDesign2:::as_gt.gs_design(x, ...) +}