kmPlot: Custom Kaplan Meier plot with median lines and legends

View source: R/kmPlot.R

kmPlotR Documentation

Custom Kaplan Meier plot with median lines and legends

Description

Specific Kaplan Meier plot

Usage

kmPlot(
  fit,
  model,
  colors_v = c("blue", "red"),
  labels_v = c(Low = "low", High = "up"),
  main_v = "KM Survival",
  xlab_v = "Overall Survival",
  ylab_v = "Prop. Survival",
  max_x,
  leg_y = c(med = 1, rec = 0.83, p = 0.7),
  fileName_v = NA
)

Arguments

fit

"survfit" object created by survfit() function

model

"survdiff" object created by survdiff() function

colors_v

vector of colors to plot. Must be same length as number of divisions in fit

labels_v

named vector of divisions in survival model. Names will be displayed on legend, values must match those of fit/model.

main_v

title for plot

xlab_v

label for X-axis. Default is "Overall Survival"

ylab_v

label for y-axis. Default is "Prop. Survival"

max_x

Max x-value from original data that created fit. Used for placing legends

leg_y

named vector of legend y-axis placements. Names are 'med', 'p', and 'rec'. Legends will only be printed if they have a leg_y value.

fileName_v

path to output file where plot will be printed. If NA, will print to stdout.

Value

plot to console of Kaplan Meier survival estimate


weshorton/wrh.rUtils documentation built on Oct. 28, 2024, 7:24 a.m.