displayCoxPH: Function to display a coxph() object

Description Usage Arguments Value Author(s) Examples

View source: R/displayCoxPH.r

Description

Generate a LaTeX table of a coxph object. To be used in a Sweave document.

Usage

1
displayCoxPH(mod, cap = "", lab = "mod", dig.coef = 2, dig.p = 1)

Arguments

mod

coxph object.

cap

The function provides an automatic caption displaying the number of observations and events in mod. If cap != "" this string is added to the default caption.

lab

The LaTeX label for the generated table.

dig.coef

The number of significant digits for the estimated coefficients and the hazard ratios.

dig.p

The number of significant digits for p-values.

Value

Returns a LaTeX table containing columns with the estimated coefficients, hazard ratios, 95 percent confidence intervals for the hazard ratios and the p-values.

Author(s)

Kaspar Rufibach (maintainer), kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# use example from coxph() in library 'survival'
test1 <- list(time = c(4, 3, 1, 1, 2, 2, 3),  
              status = c(1, 1, 1, 0, 1, 1, 0),  
              x = c(0, 2, 1, 1, 1, 0, 0),  
              sex = c(0, 0, 0, 0, 1, 1, 1)) 

# fit a coxph() model
mod1 <- coxph(Surv(time, status) ~ x + sex, data = test1) 

# generate table to insert in Sweave file
m1 <- displayCoxPH(mod1)

## End(Not run)

reporttools documentation built on Oct. 12, 2021, 5:06 p.m.