From 9ccde9c8f6d01f3a80e44b4b4f2b8079e1037e70 Mon Sep 17 00:00:00 2001 From: John Blischak Date: Wed, 19 Feb 2025 15:06:46 -0500 Subject: [PATCH 1/2] Fix as_gt() examples --- R/as_gt.R | 22 +++++++++++++--------- man/as_gt.Rd | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/R/as_gt.R b/R/as_gt.R index f22a39f26..3e14039d9 100644 --- a/R/as_gt.R +++ b/R/as_gt.R @@ -32,7 +32,9 @@ as_gt <- function(x, ...) { #' #' @export #' -#' @examplesIf interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' @examplesIf !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' # Fixed design examples ---- +#' #' library(dplyr) #' #' # Enrollment rate @@ -154,7 +156,9 @@ fd_footnote <- function(x, method) { #' #' @export #' -#' @examplesIf interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' @examplesIf !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' # Group sequential design examples --- +#' #' library(dplyr) #' # Example 1 ---- #' # The default output @@ -163,7 +167,7 @@ fd_footnote <- function(x, method) { #' summary() %>% #' as_gt() #' -#' gs_power_ahr() %>% +#' gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt() #' @@ -171,7 +175,7 @@ fd_footnote <- function(x, method) { #' summary() %>% #' as_gt() #' -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt() #' @@ -190,7 +194,7 @@ fd_footnote <- function(x, method) { #' # Example 2 ---- #' # Usage of title = ..., subtitle = ... #' # to edit the title/subtitle -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt( #' title = "Bound Summary", @@ -200,7 +204,7 @@ fd_footnote <- function(x, method) { #' # Example 3 ---- #' # Usage of colname_spanner = ..., colname_spannersub = ... #' # to edit the spanner and its sub-spanner -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt( #' colname_spanner = "Cumulative probability to cross boundaries", @@ -210,7 +214,7 @@ fd_footnote <- function(x, method) { #' # Example 4 ---- #' # Usage of footnote = ... #' # to edit the footnote -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt( #' footnote = list( @@ -228,14 +232,14 @@ fd_footnote <- function(x, method) { #' # Example 5 ---- #' # Usage of display_bound = ... #' # to either show efficacy bound or futility bound, or both(default) -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt(display_bound = "Efficacy") #' #' # Example 6 ---- #' # Usage of display_columns = ... #' # to select the columns to display in the summary table -#' gs_power_wlr() %>% +#' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability")) #' diff --git a/man/as_gt.Rd b/man/as_gt.Rd index 7b342d85d..58d1ee1f7 100644 --- a/man/as_gt.Rd +++ b/man/as_gt.Rd @@ -59,7 +59,9 @@ A \code{gt_tbl} object. Convert summary table of a fixed or group sequential design object to a gt object } \examples{ -\dontshow{if (interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (!identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# Fixed design examples ---- + library(dplyr) # Enrollment rate @@ -106,7 +108,9 @@ fixed_design_fh( summary() \%>\% as_gt() \dontshow{\}) # examplesIf} -\dontshow{if (interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (!identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +# Group sequential design examples --- + library(dplyr) # Example 1 ---- # The default output @@ -115,7 +119,7 @@ gs_design_ahr() \%>\% summary() \%>\% as_gt() -gs_power_ahr() \%>\% +gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt() @@ -123,7 +127,7 @@ gs_design_wlr() \%>\% summary() \%>\% as_gt() -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt() @@ -142,7 +146,7 @@ gs_power_rd() \%>\% # Example 2 ---- # Usage of title = ..., subtitle = ... # to edit the title/subtitle -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt( title = "Bound Summary", @@ -152,7 +156,7 @@ gs_power_wlr() \%>\% # Example 3 ---- # Usage of colname_spanner = ..., colname_spannersub = ... # to edit the spanner and its sub-spanner -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt( colname_spanner = "Cumulative probability to cross boundaries", @@ -162,7 +166,7 @@ gs_power_wlr() \%>\% # Example 4 ---- # Usage of footnote = ... # to edit the footnote -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt( footnote = list( @@ -180,14 +184,14 @@ gs_power_wlr() \%>\% # Example 5 ---- # Usage of display_bound = ... # to either show efficacy bound or futility bound, or both(default) -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt(display_bound = "Efficacy") # Example 6 ---- # Usage of display_columns = ... # to select the columns to display in the summary table -gs_power_wlr() \%>\% +gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability")) \dontshow{\}) # examplesIf} From d7938a3dab530c3f6b17ae1702d89756fa1be689 Mon Sep 17 00:00:00 2001 From: John Blischak Date: Thu, 20 Feb 2025 10:34:35 -0500 Subject: [PATCH 2/2] Wrap as_gt.gs_design() examples in \donttest{} --- R/as_gt.R | 3 ++- man/as_gt.Rd | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/R/as_gt.R b/R/as_gt.R index 3e14039d9..ad1b4814f 100644 --- a/R/as_gt.R +++ b/R/as_gt.R @@ -157,6 +157,7 @@ fd_footnote <- function(x, method) { #' @export #' #' @examplesIf !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' \donttest{ #' # Group sequential design examples --- #' #' library(dplyr) @@ -242,7 +243,7 @@ fd_footnote <- function(x, method) { #' gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) %>% #' summary() %>% #' as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability")) -#' +#' } as_gt.gs_design <- function( x, title = NULL, diff --git a/man/as_gt.Rd b/man/as_gt.Rd index 58d1ee1f7..502e217a9 100644 --- a/man/as_gt.Rd +++ b/man/as_gt.Rd @@ -109,6 +109,7 @@ fixed_design_fh( as_gt() \dontshow{\}) # examplesIf} \dontshow{if (!identical(Sys.getenv("IN_PKGDOWN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\donttest{ # Group sequential design examples --- library(dplyr) @@ -194,5 +195,6 @@ gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% gs_power_wlr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) \%>\% summary() \%>\% as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability")) +} \dontshow{\}) # examplesIf} }