Creates a valid expression to generate a Kaplan-Meier plot.
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"
)
a list
of expressions to generate a table or plot object.
(character
)
analysis data used in teal module.
(character
)
variable names that can be used as arm_var
.
(character
)
the level of reference arm in case of arm comparison.
(character
)
the level of comparison arm in case of arm comparison.
(logical
)
triggers the comparison between study arms.
(logical
)
triggers the combination of comparison arms.
(character
)
name of the analysis value variable.
(character
)
name of the censoring variable.
(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.
(character
)
names of the variables for stratified analysis.
(character
)
time points that can be used in tern::surv_timepoint()
.
(character
)
name of the variable to use to facet the plot.
(numeric
)
font size value.
(numeric
)
value for the confidence level within the range of (0, 1).
(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.
(string
)
label of x-axis.
(character
)
name of the variable representing time units.
(string
)
value of y-axis. Options are Survival
(default) and Failure
probability.
(string
)
the method used for estimation of p.values; wald
(default) or likelihood
.
(flag
)
compute and add the annotation table on the Kaplan-Meier curve estimating the
median survival time per group.
(flag
)
add the annotation table from a survival::coxph()
model.
(numeric
)
x and y positions for plotting survival::coxph()
model.
(named list
of unit
s)
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.
(flag
)
draw the confidence interval around the Kaplan-Meier curve.
(character
)
title of the output.
tm_g_km()