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 = 11,
conf_level = 0.95,
ties = "efron",
xlab = "Survival time",
time_unit_var = "AVALU",
yval = "Survival",
ylim = NULL,
pval_method = "log-rank",
annot_surv_med = TRUE,
annot_coxph = TRUE,
control_annot_surv_med = control_surv_med_annot(),
control_annot_coxph = control_coxph_annot(x = 0.27, y = 0.35, w = 0.3),
legend_pos = NULL,
position_coxph = lifecycle::deprecated(),
width_annots = lifecycle::deprecated(),
rel_height_plot = 0.8,
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
or NULL
)
numeric vector of tick positions or a single number with spacing
between ticks on the x-axis. If NULL
(default), labeling::extended()
is used to determine
optimal tick positions 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
)
x-axis label.
(character
)
name of the variable representing time units.
(string
)
type of plot, to be plotted on the y-axis. Options are Survival
(default) and Failure
probability.
(numeric(2)
)
vector containing lower and upper limits for the y-axis, respectively.
If NULL
(default), the default scale range is used.
(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
)
whether to add the annotation table from a survival::coxph()
model.
(list
)
parameters to control the position and size of the annotation table added
to the plot when annot_surv_med = TRUE
, specified using the control_surv_med_annot()
function. Parameter
options are: x
, y
, w
, h
, and fill
. See control_surv_med_annot()
for details.
(list
)
parameters to control the position and size of the annotation table added
to the plot when annot_coxph = TRUE
, specified using the control_coxph_annot()
function. Parameter
options are: x
, y
, w
, h
, fill
, and ref_lbls
. See control_coxph_annot()
for details.
(numeric(2)
or NULL
)
vector containing x- and y-coordinates, respectively, for the legend
position relative to the KM plot area. If NULL
(default), the legend is positioned in the bottom right corner of
the plot, or the middle right of the plot if needed to prevent overlapping.
Please use the
x
and y
elements of
control_annot_coxph
instead.
Please use the
w
element of control_annot_surv_med
(for surv_med
) and control_annot_coxph
(for coxph
)."
(proportion
)
proportion of total figure height to allocate to the Kaplan-Meier plot.
Relative height of patients at risk table is then 1 - rel_height_plot
. If annot_at_risk = FALSE
or
as_list = TRUE
, this parameter is ignored.
(flag
)
whether the confidence interval should be drawn around the Kaplan-Meier curve.
(character
)
title of the output.
tm_g_km()