tabcoxph: Create Summary Table for Fitted Cox Proportional Hazards...

Description Usage Arguments Value References Examples

View source: R/archived/tabcoxph-2020-03-28.R View source: R/tabcoxph.R

Description

Creates a table summarizing a GEE fit using the coxph function.

Usage

1
2
3
4
5
6
7
8
9
tabcoxph(
  fit,
  columns = c("beta.se", "hr.ci", "p"),
  var.labels = NULL,
  factor.compression = 1,
  sep.char = ", ",
  decimals = 2,
  formatp.list = NULL
)

Arguments

fit

Fitted coxph object.

columns

Character vector specifying what columns to include. Choies for each element are "events", "beta", "se", "beta.se", "beta.betaci", "betaci", "hr", "hr.hrci", "hrci", "z", and "p".

var.labels

Named list specifying labels to use for certain predictors. For example, if fit includes a predictor named "race" that you want to label "Race/ethnicity" and a predictor named "age_yrs" that you want to label "Age (years)", use var.labels = list(race = "Race/ethnicity", age_yrs = "Age (years)".

factor.compression

Integer value from 1 to 5 controlling how much compression is applied to factor predictors (higher value = more compression). If 1, rows are Variable, Level 1 (ref), Level 2, ...; if 2, rows are Variable (ref = Level 1), Level 2, ...; if 3, rows are Level 1 (ref), Level 2, ...; if 4, rows are Level 2 (ref = Level 1), ...; if 5, rows are Level 2, ...

sep.char

Character string with separator to place between lower and upper bound of confidence intervals. Typically "-" or ", ".

decimals

Numeric value specifying number of decimal places for numbers other than p-values.

formatp.list

List of arguments to pass to formatp.

Value

kable.

References

1. Therneau, T. (2015). A Package for Survival Analysis in S. R package version 2.38. https://cran.r-project.org/package=survival.

2. Therneau, T.M. and Grambsch, P.M. (2000). Modeling Survival Data: Extending the Cox Model. Springer, New York. ISBN 0-387-98784-3.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Cox PH model with age, sex, race, and treatment
library("survival")
fit <- coxph(
  Surv(time = time, event = delta) ~ Age + Sex + Race + Group,
  data = tabdata
)
tabcoxph(fit)

# Can also use piping
fit %>% tabcoxph()

# Same as previous, but with custom labels for Age and Race and factors
# displayed in slightly more compressed format
fit %>%
  tabcoxph(
    var.labels = list(Age = "Age (years)", Race = "Race/ethnicity"),
    factor.compression = 2
  )

# Cox PH model with some higher-order terms
fit <- coxph(
  Surv(time = time, event = delta) ~
  poly(Age, 2, raw = TRUE) + Sex + Race + Group + Race*Group,
  data = tabdata
)
fit %>% tabcoxph()

tab documentation built on Aug. 2, 2021, 9:06 a.m.