add_nevent.tbl_survfit: Add column with number of observed events

Description Usage Arguments Example Output See Also Examples

View source: R/add_nevent.R

Description

\lifecycle

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

Usage

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

Arguments

x

object of class 'tbl_survfit'

...

Not used

Example Output

Example 1

See Also

Other tbl_survfit tools: add_n.tbl_survfit(), add_p.tbl_survfit(), modify, tbl_merge(), tbl_stack(), tbl_survfit()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(survival)
fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial)
fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial)

# Example 1 ----------------------------------
add_nevent.tbl_survfit_ex1 <-
  list(fit1, fit2) %>%
  tbl_survfit(times = c(12, 24)) %>%
  add_n() %>%
  add_nevent()

ddsjoberg/gtsummary documentation built on April 8, 2021, 5:48 a.m.