add_cuminc | R Documentation |
tbl_cuminc()
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
## 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, ...)
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 1
Example 2
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.
Other tbl_cuminc tools:
tbl_cuminc()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.