add_cuminc: Additional Functions for 'tbl_cuminc()'

add_cumincR Documentation

Additional Functions for tbl_cuminc()

Description

  • add_p() Add column with p-value comparing incidence across stratum

  • add_n() Add column with the total N, or N within stratum

  • add_nevent() Add column with the total number of events, or number of events within stratum

  • inline_text() Report statistics from a tbl_cuminc() table inline

Usage

## S3 method for class 'tbl_cuminc'
add_p(x, pvalue_fun = gtsummary::style_pvalue, ...)

## S3 method for class 'tbl_cuminc'
add_n(x, location = NULL, ...)

## S3 method for class 'tbl_cuminc'
add_nevent(x, location = NULL, ...)

## S3 method for class 'tbl_cuminc'
inline_text(x, time = NULL, column = NULL, outcome = NULL, level = NULL, ...)

Arguments

x

object of class 'tbl_cuminc'

pvalue_fun

function to style/format p-values. Default is gtsummary::style_pvalue

...

These dots are for future extensions and must be empty.

location

location to place Ns. When "label" total Ns are placed on each variable's label row. When "level" level counts are placed on the variable level for categorical variables, and total N on the variable's label row for continuous.

time

time of statistic to report

column

column name of the statistic to report

outcome

string indicating the outcome to select from. If NULL, the first outcome is used.

level

if estimates are stratified, level of the stratum to report

Example Output

Example 1

add_cuminc_ex1.png

Example 2

add_cuminc_ex2.png

p-values

The p-values reported in cuminc(), glance.tidycuminc() and add_p.tbl_cuminc() are Gray's test as described in Gray RJ (1988) A class of K-sample tests for comparing the cumulative incidence of a competing risk, Annals of Statistics, 16:1141-1154.

See Also

Other tbl_cuminc tools: tbl_cuminc()

Examples

# Example 1 ----------------------------------
add_cuminc_ex1 <-
  cuminc(Surv(ttdeath, death_cr) ~ 1, trial) %>%
  tbl_cuminc(times = c(12, 24), label_header = "**Month {time}**") %>%
  add_nevent() %>%
  add_n()

# Example 2 ----------------------------------
add_cuminc_ex2 <-
  cuminc(Surv(ttdeath, death_cr) ~ trt, trial) %>%
  tbl_cuminc(times = c(12, 24),
             outcomes = c("death from cancer", "death other causes"),
             label_header = "**Month {time}**") %>%
  add_p() %>%
  add_nevent(location = c("label", "level")) %>%
  add_n(location = c("label", "level"))

# inline_text() ------------------------------
inline_text(add_cuminc_ex2, time = 12, level = "Drug A")
inline_text(add_cuminc_ex2, column = p.value)


tidycmprsk documentation built on Sept. 11, 2024, 7:24 p.m.