ezcox_group: Group Cox Analysis and Visualization

View source: R/ezgrp.R

ezcox_groupR Documentation

Group Cox Analysis and Visualization

Description

Group Cox Analysis and Visualization

Usage

ezcox_group(
  data,
  grp_var,
  covariate,
  controls = NULL,
  time = "time",
  status = "status",
  sort = FALSE,
  decreasing = TRUE,
  add_all = FALSE,
  add_caption = TRUE,
  verbose = TRUE,
  headings = list(variable = "Group", n = "N", measure = "Hazard ratio", ci = NULL, p =
    "p"),
  ...
)

Arguments

data

a data.frame containing variables, time and os status.

grp_var

a group column.

covariate

a covariable for cox analysis.

controls

column names specifying controls. The names with pattern "*:|()" will be treated as interaction/combination term, please make sure all column names in data are valid R variable names.

time

column name specifying time, default is 'time'.

status

column name specifying event status, default is 'status'.

sort

if TRUE, sort the models by the HR values.

decreasing

logical, should the sort order be increasing or decreasing?

add_all

if TRUE, add a group for all data rows.

add_caption

if TRUE, add caption to the plot.

verbose

if TRUE, print extra info.

headings

a list for setting the heading text.

...

other arguments passing to forestmodel::forest_model().

Value

a list.

Examples

library(survival)
ezcox_group(lung, grp_var = "sex", covariate = "ph.ecog")
ezcox_group(lung, grp_var = "sex", covariate = "ph.ecog", controls = "age")
p <- ezcox_group(lung,
  grp_var = "sex", covariate = "ph.ecog",
  controls = "age", add_all = TRUE
)

ezcox documentation built on May 31, 2023, 7:49 p.m.