| er_tte_add_curve | R Documentation |
Adds the curve layer to a TTE plot: a Kaplan-Meier step curve with a confidence band, computed from the fit already contained within the plot object.
er_tte_add_curve(object, style = NULL, ...)
object |
Partially constructed plot (has S3 class |
style |
Style used to draw the Kaplan-Meier curve and ribbon. Can
either be a string corresponding to one of the registered style labels
(e.g., |
... |
Additional named arguments forwarded to the |
The input object, with the curve layer added.
The following pre-defined styles are available for this layer. Please see the documentation for the corresponding builder function to see what customisation options are available:
| Label | Builder | Description |
"km" | er_style_tte_curve_km() | Kaplan-Meier step curve with a confidence band (the only built-in, and the default). |
See er_style_tte() for details on how style builder functions are
defined for the TTE mini-grammar, should a custom style be required.
er_tte(), er_style_tte_curve_km()
library(survival)
lung |>
er_tte(time, status == 2) |>
er_tte_add_curve() |>
plot()
lung |>
transform(sex = factor(sex, labels = c("Male", "Female"))) |>
er_tte(time, status == 2, stratify_by = sex) |>
er_tte_add_curve() |>
plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.