display_coxph2: Display Cox Proportional Hazards Regression Results (given...

display_coxph2R Documentation

Display Cox Proportional Hazards Regression Results (given variable names)

Description

Given a string with an "outcome" and a vector string with "predictors", displays univariable and (optionally) multivariable results from Cox proportional hazards regression in a format suitable for presentation.

This version allows you to explicitly provide the outcome and predictors in case there are issues with getting a full model fit.

Usage

display_coxph2(
  data,
  outcome,
  predictors,
  add_multi = FALSE,
  format = "html",
  conf_level = 0.95,
  exponentiate = TRUE,
  include_last_row = TRUE
)

Arguments

data

A tibble or data frame with the full dataset.

outcome

Character string. The dependent variable (outcome) for Cox regression, formatted as "Surv(time, event)".

predictors

Character vector. Independent variables (predictors/covariates) for univariable and/or multivariable modeling.

add_multi

Logical; 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

Adds a row at the end of each set of results for spacing. Default is TRUE.

Value

A tibble containing Cox regression results.

Examples

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

display_coxph2(data = lung,
               outcome = "Surv(time, status)",
               predictors = c("age", "sex", "ph.ecog"))

display_coxph2(data = lung,
               outcome = "Surv(time, status)",
               predictors = c("age", "sex", "ph.ecog"),
               add_multi = TRUE)

## End(Not run)

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