draw_survival_curve | R Documentation |
Draw a survival curve based on survminer package. This is a wrapper function of ggsurvplot.
draw_survival_curve( exp, living_days, living_events, write_name, title_name = "", threshold = NA, file = FALSE )
exp |
expression level for variable. |
living_days |
The survival time (days) for each individual. |
living_events |
The survival event for each individual, 0 indicates alive and 1 indicates death. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2=death). For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored. |
write_name |
The name for pdf file which contains the result figure. |
title_name |
The title for the result figure. |
threshold |
Threshold used to indicate the high risk or low risk. |
file |
If True, function will automatic generate a result pdf, otherwise it will return a ggplot object. Default is FALSE. |
This function will generate a pdf file with 300dpi which compare survival curves using the Kaplan-Meier (KM) test.
Xin Yu
data(demo_survival_data) library(survival) demo_set<-create_demo() draw_survival_curve(demo_set[1,], living_days = demo_survival_data[,1], living_events =demo_survival_data[,2], write_name = "demo_data" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.