Learn R Programming

teal.modules.clinical (version 0.9.0)

template_g_km: Template: Kaplan-Meier Plot

Description

Creates a valid expression to generate a Kaplan-Meier plot.

Usage

template_g_km(
  dataname = "ANL",
  arm_var = "ARM",
  ref_arm = NULL,
  comp_arm = NULL,
  compare_arm = FALSE,
  combine_comp_arms = FALSE,
  aval_var = "AVAL",
  cnsr_var = "CNSR",
  xticks = NULL,
  strata_var = NULL,
  time_points = NULL,
  facet_var = "SEX",
  font_size = 10,
  conf_level = 0.95,
  ties = "efron",
  xlab = "Survival time",
  time_unit_var = "AVALU",
  yval = "Survival",
  pval_method = "log-rank",
  annot_surv_med = TRUE,
  annot_coxph = TRUE,
  position_coxph = c(-0.04, 0.02),
  width_annots = list(surv_med = grid::unit(0.45, "npc"), coxph = grid::unit(0.6, "npc")),
  ci_ribbon = FALSE,
  title = "KM Plot"
)

Value

a list of expressions to generate a table or plot object.

Arguments

dataname

(character)
analysis data used in teal module.

arm_var

(character)
variable names that can be used as arm_var.

ref_arm

(character)
the level of reference arm in case of arm comparison.

comp_arm

(character)
the level of comparison arm in case of arm comparison.

compare_arm

(logical)
triggers the comparison between study arms.

combine_comp_arms

(logical)
triggers the combination of comparison arms.

aval_var

(character)
name of the analysis value variable.

cnsr_var

(character)
name of the censoring variable.

xticks

(numeric, number, or NULL)
numeric vector of ticks or single number with spacing between ticks on the x axis. If NULL (default), labeling::extended() is used to determine an optimal tick position on the x axis.

strata_var

(character)
names of the variables for stratified analysis.

time_points

(character)
time points that can be used in tern::surv_timepoint().

facet_var

(character)
name of the variable to use to facet the plot.

font_size

(numeric)
font size value.

conf_level

(numeric)
value for the confidence level within the range of (0, 1).

ties

(string)
among exact (equivalent to DISCRETE in SAS), efron and breslow, see survival::coxph(). Note: there is no equivalent of SAS EXACT method in R.

xlab

(string)
label of x-axis.

time_unit_var

(character)
name of the variable representing time units.

yval

(string)
value of y-axis. Options are Survival (default) and Failure probability.

pval_method

(string)
the method used for estimation of p.values; wald (default) or likelihood.

annot_surv_med

(flag)
compute and add the annotation table on the Kaplan-Meier curve estimating the median survival time per group.

annot_coxph

(flag)
add the annotation table from a survival::coxph() model.

position_coxph

(numeric)
x and y positions for plotting survival::coxph() model.

width_annots

(named list of units)
a named list of widths for annotation tables with names surv_med (median survival time table) and coxph (survival::coxph() model table), where each value is the width (in units) to implement when printing the annotation table.

ci_ribbon

(flag)
draw the confidence interval around the Kaplan-Meier curve.

title

(character)
title of the output.

See Also

tm_g_km()