| km | R Documentation | 
Using ggsurvplot function from survminer to plot Kaplan-Meier plot
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)
)
| 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. | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.