Learn R Programming

reporttools (version 1.1.3)

displayCoxPH: Function to display a coxph() object

Description

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

Usage

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.

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab