This function will plot a KM or CIF curve with option to add the number at risk. You can specify if you want confidence bands, the hazard ratio, and pvalues, as well as the units of time used.

ggkmcif2(
  response,
  cov = NULL,
  data,
  pval = TRUE,
  conf.curves = FALSE,
  table = TRUE,
  xlab = "Time",
  ylab = NULL,
  col = NULL,
  times = NULL,
  type = NULL,
  plot.event = 1,
  returns = FALSE,
  ...
)

Arguments

response

Character vector with time and status column names

cov

Covariate column name (optional)

data

Input dataframe

pval

Whether to show p-values

conf.curves

Whether to show confidence bands

table

Whether to include risk table

xlab

X-axis label

ylab

Y-axis label

col

colours vector

times

Numeric vector of times for the x-axis

type

Plot type ("KM" or "CIF", auto-detected if NULL)

plot.event

Events to plot

returns

Whether to return list with plot and at risk table

...

Additional arguments see see ggkmcif2Parameters

Details

Note that for proper pdf output of special characters the following code needs to be included in the first chunk of the rmd knitr::opts_chunk$set(dev="cairo_pdf")