build_table.coxph {utile.tables} | R Documentation |
Build summary tables from coxph model objects
Description
Takes a Cox PH model object and summarizes it into a ready to export, human-readable summary table.
Usage
## S3 method for class 'coxph'
build_table(
.object,
...,
.test = c("LRT", "Wald"),
.col.test = FALSE,
.level = 0.95,
.stat.pct.sign = TRUE,
.digits = 1,
.p.digits = 4
)
Arguments
.object |
An object of class |
... |
One or more unquoted expressions separated by commas representing
columns in the data.frame. May be specified using
|
.test |
A character. The name of the
|
.col.test |
A logical. Append a columns for the test and accompanying statistic used to derive the p-value. |
.level |
A double. The confidence level required. |
.stat.pct.sign |
A logical. Paste a percent symbol after all reported frequencies. |
.digits |
An integer. The number of digits to round numbers to. |
.p.digits |
An integer. The number of p-value digits to report. Note
that the p-value still rounded to the number of digits specified in
|
Value
An object of class tbl_df
(tibble) summarizing the provided
object.
See Also
Examples
library(survival)
library(dplyr)
data_lung <- lung |>
mutate_at(vars(inst, status, sex), as.factor) |>
mutate(status = case_when(status == 1 ~ 0, status == 2 ~ 1))
fit <- coxph(Surv(time, status) ~ sex + meal.cal, data = data_lung)
fit |> build_table(Sex = sex, Calories = meal.cal, .test = 'LRT')