display_coxph: Display Cox Proportional Hazards Regression Results

View source: R/display-coxph.R

display_coxphR Documentation

Display Cox Proportional Hazards Regression Results

Description

Given a coxph model fit object, displays univariable and (optionally) multivariable results from Cox proportional hazards regression in a format suitable for presentation.

Usage

display_coxph(
  fit,
  data,
  add_multi = FALSE,
  format = "html",
  conf_level = 0.95,
  exponentiate = TRUE,
  include_last_row = TRUE
)

Arguments

fit

An object of class coxph from the survival package, representing a Cox proportional hazards model.

data

A tibble or data frame with the full dataset used for modeling.

add_multi

Logical; whether to include multivariable results. Default is FALSE.

format

Display format in case characters need escaping. Placeholder for future use. Default is "html".

conf_level

The confidence level to use for confidence intervals. Must be between 0 and 1. Default is 0.95.

exponentiate

Logical; whether to exponentiate coefficient estimates to show hazard ratios. Default is TRUE.

include_last_row

Logical; if TRUE, adds a blank row at the end for spacing. Default is TRUE.

Value

A tibble containing the Cox regression results.

Examples

## Not run: 
library(survival)
data(lung)

# Fit a Cox model
fit <- coxph(Surv(time, status) ~ age + sex + ph.ecog, data = lung)

# Display Cox regression results
display_coxph(fit, data = lung, add_multi = TRUE)

## End(Not run)


emilelatour/latable documentation built on Nov. 25, 2024, 4:58 a.m.