er_style_tte_censor: Censoring-mark builders for the TTE grammar

er_style_tte_censorR Documentation

Censoring-mark builders for the TTE grammar

Description

Builder functions for the censor layer (er_tte_add_censor()), marking each censoring time directly on the Kaplan-Meier curve.

Usage

er_style_tte_censor_ticks(
  data,
  config,
  stratify,
  time,
  strata,
  theme,
  shape = 3,
  point_size = 2,
  stroke = 0.75,
  ...
)

Arguments

data

The original data frame (object$data).

config

Configuration for the censor layer (populated by er_tte_add_censor()): config$table (the subset of the tidy KM table where n_censor > 0, with a strata column when stratified).

stratify

Logical: whether the fit is stratified (!is.null(object$strata)).

time

object$time (name/label/limits).

strata

object$strata (var/label), or NULL when unstratified.

theme

object$theme.

shape

Point shape for a censoring mark. Default 3 (a plus sign), the conventional Kaplan-Meier censoring glyph.

point_size

Point size. Default 2.

stroke

Point stroke width. Default 0.75.

...

Additional named arguments forwarded from er_tte_add_censor()'s own ....

Details

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.

Value

A geom, or a list of geoms.

See Also

er_tte_add_censor(), er_style_tte()

Examples

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()


erplots documentation built on Oct. 4, 2026, 5:06 p.m.