add_cuminc {tidycmprsk} | R 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 atbl_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
|
... |
These dots are for future extensions and must be empty. |
location |
location to place Ns. When |
time |
time of statistic to report |
column |
column name of the statistic to report |
outcome |
string indicating the outcome to select from. If |
level |
if estimates are stratified, level of the stratum to report |
Example Output
Example 1
Example 2
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)