| er_style_tte_censor | R Documentation |
Builder functions for the censor layer (er_tte_add_censor()),
marking each censoring time directly on the Kaplan-Meier curve.
er_style_tte_censor_ticks(
data,
config,
stratify,
time,
strata,
theme,
shape = 3,
point_size = 2,
stroke = 0.75,
...
)
data |
The original data frame ( |
config |
Configuration for the censor layer (populated by
|
stratify |
Logical: whether the fit is stratified
( |
time |
|
strata |
|
theme |
|
shape |
Point shape for a censoring mark. Default |
point_size |
Point size. Default |
stroke |
Point stroke width. Default |
... |
Additional named arguments forwarded from
|
See er_style_tte() for the shared interface every TTE-grammar
builder implements.
A censoring-only row of the KM table (n_censor > 0, n_event == 0)
carries the survival value the curve already had going into that
time – Kaplan-Meier survival only drops at an event time – so a
mark drawn at (time, surv) lands exactly on the step curve without
any extra lookup.
Stratified colour maps to config$table's own strata column, the
same already-cleaned stratum label er_style_tte_curve_km() uses,
so a censoring mark takes on the colour of the curve it sits on. The
marks never contribute their own legend entry (show.legend = FALSE) – the curve layer's legend already identifies each stratum.
er_style_tte_censor_ticks() is tagged er_style_tag(fn, layer = "censor"), so er_tte_add_censor() errors informatively if handed
a builder tagged for a different layer.
A geom, or a list of geoms.
er_tte_add_censor(), er_style_tte()
library(survival)
lung |>
er_tte(time, status == 2) |>
er_tte_add_curve() |>
er_tte_add_censor(style = er_style_tte_censor_ticks, shape = 124, point_size = 3) |>
plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.