km: Wrapper for plotting Kaplan-Meier plot

View source: R/survival.R

kmR Documentation

Wrapper for plotting Kaplan-Meier plot

Description

Using ggsurvplot function from survminer to plot Kaplan-Meier plot

Usage

km(
  response,
  time,
  endpoint,
  titlePlot = "KM plot",
  pval = NULL,
  stat = "median",
  maxTime = NULL,
  showP = TRUE,
  showTable = FALSE,
  ylab = "Fraction",
  xlab = "Time (years)",
  table_ratio = c(0.7, 0.3)
)

Arguments

response

The response variable

time

Time variable, e.g. time to treatment, time to last known alive...

endpoint

Event variable, e.g. treatment, died...

titlePlot

Plot title.

pval

The p value that needs to be shown in the plot. If NULL, the p value will be calculated automatically.

stat

The method to stratify samples. If the reponse variable is catagorical, only "binary" should be used. If the response variable is continous, either "median" or "maxstat" can be used.

maxTime

Truncate the maximal time duration.

showP

Whether to show P value in the plot.

showTable

Whether to show the "number at risks" table under the KM plot.

ylab

Label for y axis.

xlab

Label for x axis.

table_ration

The ration of height between the KM plot and the table below.


lujunyan1118/jyluMisc documentation built on March 8, 2024, 12:17 a.m.