timepoints2: 'timepoints' formatter

View source: R/cuminc2.R

timepoints2R Documentation

timepoints formatter

Description

Format output from timepoints into a single matrix with estimate +/- standard deviation.

Usage

timepoints2(
  w,
  times = NULL,
  digits = ifelse(percent, 0L, 3L),
  sd = FALSE,
  ci = FALSE,
  alpha = 0.05,
  percent = FALSE,
  html = FALSE,
  htmlArgs = list(),
  ...
)

Arguments

w, times

arguments passed to timepoints

digits

number of digits past the decimal point to keep

sd

logical; if FALSE, the standard deviation will not be shown with the estimate

ci, alpha

logical; calculate a confidence interval using a two-sided alpha

percent

logical; if TRUE, percentages are shown instead of probabilities

html

logical; if TRUE, an html-friendly format is returned; the print method for timepoints2 will use htmlTable if html = TRUE

htmlArgs

for html = TRUE, a named list of arguments passed to htmlTable for additional formatting or to override defaults

...

ignored

Examples

ci <- cuminc2(Surv(futime, event(censored)) ~ sex, transplant)
timepoints2(ci, sd = TRUE)
timepoints2(ci, html = TRUE)

print(
  timepoints2(ci, sd = TRUE, html = TRUE),
  rgroup = c('Death', 'Ltx', 'Withdraw'), n.rgroup = c(2, 2, 2),
  caption = 'Timepoints<sup>&dagger;</sup>',
  tfoot = '<sup>&dagger;</sup>Estimate &pm; SD'
)


## example from cmprsk::cuminc
set.seed(2)
ss <- rexp(100)
gg <- factor(sample(1:3, 100, replace = TRUE), 1:3, c('a', 'b', 'c'))
cc <- sample(0:2, 100, replace = TRUE)
strt <- sample(1:2, 100, replace = TRUE)
xx <- cuminc(ss, cc, gg, strt)

timepoints(xx, times = 0:4)
timepoints2(xx, times = 0:4)


raredd/cmprsk2 documentation built on March 29, 2024, 5:34 a.m.