plot_kaplan_meier | R Documentation |
This function creates Kaplan-Meier survival curves from stratification data stored in a familiarCollection object.
plot_kaplan_meier(
object,
draw = FALSE,
dir_path = NULL,
split_by = NULL,
color_by = NULL,
linetype_by = NULL,
facet_by = NULL,
facet_wrap_cols = NULL,
combine_legend = TRUE,
ggtheme = NULL,
discrete_palette = NULL,
x_label = "time",
x_label_shared = "column",
y_label = "survival probability",
y_label_shared = "row",
legend_label = waiver(),
plot_title = waiver(),
plot_sub_title = waiver(),
caption = NULL,
x_range = NULL,
x_n_breaks = 5,
x_breaks = NULL,
y_range = c(0, 1),
y_n_breaks = 5,
y_breaks = NULL,
confidence_level = NULL,
conf_int_style = c("ribbon", "step", "none"),
conf_int_alpha = 0.4,
censoring = TRUE,
censor_shape = "plus",
show_logrank = TRUE,
show_survival_table = TRUE,
width = waiver(),
height = waiver(),
units = waiver(),
export_collection = FALSE,
...
)
## S4 method for signature 'ANY'
plot_kaplan_meier(
object,
draw = FALSE,
dir_path = NULL,
split_by = NULL,
color_by = NULL,
linetype_by = NULL,
facet_by = NULL,
facet_wrap_cols = NULL,
combine_legend = TRUE,
ggtheme = NULL,
discrete_palette = NULL,
x_label = "time",
x_label_shared = "column",
y_label = "survival probability",
y_label_shared = "row",
legend_label = waiver(),
plot_title = waiver(),
plot_sub_title = waiver(),
caption = NULL,
x_range = NULL,
x_n_breaks = 5,
x_breaks = NULL,
y_range = c(0, 1),
y_n_breaks = 5,
y_breaks = NULL,
confidence_level = NULL,
conf_int_style = c("ribbon", "step", "none"),
conf_int_alpha = 0.4,
censoring = TRUE,
censor_shape = "plus",
show_logrank = TRUE,
show_survival_table = TRUE,
width = waiver(),
height = waiver(),
units = waiver(),
export_collection = FALSE,
...
)
## S4 method for signature 'familiarCollection'
plot_kaplan_meier(
object,
draw = FALSE,
dir_path = NULL,
split_by = NULL,
color_by = NULL,
linetype_by = NULL,
facet_by = NULL,
facet_wrap_cols = NULL,
combine_legend = TRUE,
ggtheme = NULL,
discrete_palette = NULL,
x_label = "time",
x_label_shared = "column",
y_label = "survival probability",
y_label_shared = "row",
legend_label = waiver(),
plot_title = waiver(),
plot_sub_title = waiver(),
caption = NULL,
x_range = NULL,
x_n_breaks = 5,
x_breaks = NULL,
y_range = c(0, 1),
y_n_breaks = 5,
y_breaks = NULL,
confidence_level = NULL,
conf_int_style = c("ribbon", "step", "none"),
conf_int_alpha = 0.4,
censoring = TRUE,
censor_shape = "plus",
show_logrank = TRUE,
show_survival_table = TRUE,
width = waiver(),
height = waiver(),
units = waiver(),
export_collection = FALSE,
...
)
object |
|
draw |
(optional) Draws the plot if TRUE. |
dir_path |
(optional) Path to the directory where created figures are
saved to. Output is saved in the |
split_by |
(optional) Splitting variables. This refers to column names on which datasets are split. A separate figure is created for each split. See details for available variables. |
color_by |
(optional) Variables used to determine fill colour of plot
objects. The variables cannot overlap with those provided to the |
linetype_by |
(optional) Variables that are used to determine the
linetype of lines in a plot. The variables cannot overlap with those
provided to the |
facet_by |
(optional) Variables used to determine how and if facets of
each figure appear. In case the |
facet_wrap_cols |
(optional) Number of columns to generate when facet wrapping. If NULL, a facet grid is produced instead. |
combine_legend |
(optional) Flag to indicate whether the same legend
is to be shared by multiple aesthetics, such as those specified by
|
ggtheme |
(optional) |
discrete_palette |
(optional) Palette to use to color the different
risk strata in case a non-singular variable was provided to the |
x_label |
(optional) Label to provide to the x-axis. If NULL, no label is shown. |
x_label_shared |
(optional) Sharing of x-axis labels between facets. One of three values:
|
y_label |
(optional) Label to provide to the y-axis. If NULL, no label is shown. |
y_label_shared |
(optional) Sharing of y-axis labels between facets. One of three values:
|
legend_label |
(optional) Label to provide to the legend. If NULL, the legend will not have a name. |
plot_title |
(optional) Label to provide as figure title. If NULL, no title is shown. |
plot_sub_title |
(optional) Label to provide as figure subtitle. If NULL, no subtitle is shown. |
caption |
(optional) Label to provide as figure caption. If NULL, no caption is shown. |
x_range |
(optional) Value range for the x-axis. |
x_n_breaks |
(optional) Number of breaks to show on the x-axis of the
plot. |
x_breaks |
(optional) Break points on the x-axis of the plot. |
y_range |
(optional) Value range for the y-axis. |
y_n_breaks |
(optional) Number of breaks to show on the y-axis of the
plot. |
y_breaks |
(optional) Break points on the y-axis of the plot. |
confidence_level |
(optional) Confidence level for the strata in the plot. |
conf_int_style |
(optional) Confidence interval style. See details for allowed styles. |
conf_int_alpha |
(optional) Alpha value to determine transparency of confidence intervals or, alternatively, other plot elements with which the confidence interval overlaps. Only values between 0.0 (fully transparent) and 1.0 (fully opaque) are allowed. |
censoring |
(optional) Flag to indicate whether censored samples should be indicated on the survival curve. |
censor_shape |
(optional) Shape used to indicate censored samples on
the survival curve. Available shapes are documented in the |
show_logrank |
(optional) Specifies whether the results of a logrank
test to assess differences between the risk strata is annotated in the
plot. A log-rank test can only be shown when |
show_survival_table |
(optional) Specifies whether a survival table is
shown below the Kaplan-Meier survival curves. Survival in the risk strata
is assessed for each of the breaks in |
width |
(optional) Width of the plot. A default value is derived from the number of facets. |
height |
(optional) Height of the plot. A default value is derived from number of facets and the inclusion of survival tables. |
units |
(optional) Plot size unit. Either |
export_collection |
(optional) Exports the collection if TRUE. |
... |
Arguments passed on to
|
This function generates a Kaplan-Meier survival plot based on risk group stratification by the learners.
familiar
does not determine what units the x-axis has or what kind of
survival the y-axis represents. It is therefore recommended to provide
x_label
and y_label
arguments.
Available splitting variables are: fs_method
, learner
, data_set
,
risk_group
and stratification_method
. By default, separate figures are
created for each combination of fs_method
and learner
, with faceting by
data_set
, colouring of the strata in each individual plot by
risk_group
.
Available palettes for discrete_palette
are those listed by
grDevices::palette.pals()
(requires R >= 4.0.0), grDevices::hcl.pals()
(requires R >= 3.6.0) and rainbow
, heat.colors
, terrain.colors
,
topo.colors
and cm.colors
, which correspond to the palettes of the same
name in grDevices
. If not specified, a default palette based on palettes
in Tableau are used. You may also specify your own palette by using colour
names listed by grDevices::colors()
or through hexadecimal RGB strings.
Greenwood confidence intervals of the Kaplan-Meier curve can be shown using
various styles set by conf_int_style
:
ribbon
(default): confidence intervals are shown as a ribbon with an
opacity of conf_int_alpha
around the point estimate of the Kaplan-Meier
curve.
step
(default): confidence intervals are shown as a step function around
the point estimate of the Kaplan-Meier curve.
none
: confidence intervals are not shown. The point estimate of the ROC
curve is shown as usual.
Labelling methods such as set_risk_group_names
or set_data_set_names
can be applied to the familiarCollection
object to update labels, and
order the output in the figure.
NULL
or list of plot objects, if dir_path
is NULL
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.