quickSurvFig: Create a quick Kaplan-Meier figure with number-at-risk chart

Description Usage Arguments Value Examples

View source: R/quickSurvFig.R

Description

Create a grid of survival ggplot2 figures quickly, with little ability to modify individual components

Usage

1
2
3
4
5
6
7
8
quickSurvFig(
  formula,
  data,
  timepts = NULL,
  colors = NULL,
  ribbon = TRUE,
  heights = c(2.5, 1)
)

Arguments

formula

A formula object, which must have a 'Surv' object as the response on the left of the '~' operator and the grouping term (often the treatment) on the right.

data

A data frame in which to interpret the variables named in the formula

timepts

A numeric vector of time points to show on the x-axis

colors

Custom colors for each group line

ribbon

Logical to show a semi-transparent confidence band ribbon

heights

A vector of two numeric values that indicate the ratio of the first row to the second

Value

A grid figure

Examples

1
2
3
4
5
6
7
8
quickSurvFig(survival::Surv(stime, scens) ~ treatment, data = mice)
quickSurvFig(survival::Surv(stime, scens) ~ treatment,
  data = mice,
  timepts = c(30, 45, 60, 75, 90),
  colors = c("black", "blue", "red", "green"),
  ribbon = FALSE,
  heights = c(4, 1)
)

jbirstler/survivalFigs documentation built on Jan. 18, 2021, 6:28 p.m.