diff --git a/R/as_gt.R b/R/as_gt.R index f22a39f2..ad1b4814 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,10 @@ fd_footnote <- function(x, method) { #' #' @export #' -#' @examplesIf interactive() && !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' @examplesIf !identical(Sys.getenv("IN_PKGDOWN"), "true") +#' \donttest{ +#' # Group sequential design examples --- +#' #' library(dplyr) #' # Example 1 ---- #' # The default output @@ -163,7 +168,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 +176,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 +195,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 +205,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 +215,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,17 +233,17 @@ 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")) -#' +#' } as_gt.gs_design <- function( x, title = NULL, diff --git a/man/as_gt.Rd b/man/as_gt.Rd index 7b342d85..502e217a 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,10 @@ 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} +\donttest{ +# Group sequential design examples --- + library(dplyr) # Example 1 ---- # The default output @@ -115,7 +120,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 +128,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 +147,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 +157,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 +167,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,15 +185,16 @@ 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} }