as_gt.gs_design: This is the function to format the bounds summary table into...

View source: R/as_gt.R

as_gt.gs_designR Documentation

This is the function to format the bounds summary table into gt style.

Description

This is the function to format the bounds summary table into gt style.

Usage

## S3 method for class 'gs_design'
as_gt(
  x,
  title = NULL,
  subtitle = NULL,
  colname_spanner = "Cumulative boundary crossing probability",
  colname_spannersub = c("Alternate hypothesis", "Null hypothesis"),
  footnote = NULL,
  display_bound = c("Efficacy", "Futility"),
  display_columns = NULL,
  display_inf_bound = TRUE,
  ...
)

Arguments

x

an object returned by summary_bound

title

a string to specify the title of the gt table

subtitle

a string to specify the subtitle of the gt table

colname_spanner

a string to specify the spanner of the gt table

colname_spannersub

a vector of strings to specify the spanner details of the gt table

footnote

a list containing content, location, and attr. the content is a vector of string to specify the footnote text; the location is a vector of string to specify the locations to put the superscript of the footnote index; the attr is a vector of string to specify the attributes of the footnotes, e.g., c("colname", "title", "subtitle", "analysis", "spanner"); users can use the functions in the gt package to custom themselves.

display_bound

a vector of strings specifying the label of the bounds. The default is c("Efficacy", "Futility")

display_columns

a vector of strings specifying the variables to be displayed in the summary table

display_inf_bound

a logic value (TRUE or FALSE) whether to display the +-inf bound

...

additional arguments

Value

a gt table summarizing the bounds table in group sequential designs

Examples

# the default output 
library(dplyr)

gs_design_ahr() %>% 
  summary() %>% 
  as_gt()
  
gs_power_ahr() %>% 
  summary() %>% 
  as_gt()
  
gs_design_wlr() %>% 
  summary() %>% 
  as_gt()
  
gs_power_wlr() %>%
  summary() %>%
  as_gt()

## Not run: 
gs_design_combo() %>% 
  summary() %>% 
  as_gt() 

gs_power_combo() %>% 
  summary() %>% 
  as_gt()

gs_design_rd() %>% 
  summary() %>% 
  as_gt()

gs_power_rd() %>% 
  summary() %>% 
  as_gt()

## End(Not run) 
# usage of title = ..., subtitle = ...
# to edit the title/subtitle 
gs_power_wlr() %>% 
  summary() %>%
  as_gt(
    title = "Bound Summary",
    subtitle = "from gs_power_wlr")

# usage of colname_spanner = ..., colname_spannersub = ...
# to edit the spanner and its sub-spanner
gs_power_wlr() %>% 
  summary() %>%
  as_gt(
    colname_spanner = "Cumulative probability to cross boundaries",
    colname_spannersub = c("under H1", "under H0"))
    
# usage of footnote = ...
# to edit the footnote
gs_power_wlr() %>% 
  summary() %>%
  as_gt(
    footnote = list(content = c("approximate weighted hazard ratio to cross bound.", 
                                "wAHR is the weighted AHR.",
                                "the crossing probability.",
                                "this table is generated by gs_power_wlr."),
                   location = c("~wHR at bound", NA, NA, NA),
                   attr = c("colname", "analysis", "spanner", "title")))
                   
# usage of display_bound = ...
# to either show efficacy bound or futility bound, or both(default) 
gs_power_wlr() %>% 
  summary() %>% 
  as_gt(display_bound = "Efficacy")
  
# usage of display_columns = ...
# to select the columns to display in the summary table
gs_power_wlr() %>%
  summary() %>%
  as_gt(display_columns = c("Analysis", "Bound", "Nominal p", "Z", "Probability"))


keaven/gsDesign2 documentation built on Oct. 13, 2022, 8:42 p.m.