add_nevent.tbl_survfit: Add event N

View source: R/add_nevent.tbl_survfit.R

add_nevent.tbl_survfitR Documentation

Add event N

Description

For each survfit() object summarized with tbl_survfit() this function will add the total number of events observed in a new column.

Usage

## S3 method for class 'tbl_survfit'
add_nevent(x, ...)

Arguments

x

object of class 'tbl_survfit'

...

Not used

See Also

Other tbl_survfit tools: add_p.tbl_survfit()

Examples


library(survival)
fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial)
fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial)

# Example 1 ----------------------------------
list(fit1, fit2) |>
  tbl_survfit(times = c(12, 24)) |>
  add_n() |>
  add_nevent()


gtsummary documentation built on Oct. 5, 2024, 1:06 a.m.