Description Usage Arguments Details Author(s) Examples
ggSurvplot creates a ggplot object from a 'survfit
' object. The resulting plot can be extended using any of ggplot's many tools
1 2 3 4 |
s |
A object of class 'survfit' |
CI |
Logical indicating whether to plot confidence intervals as defined in the survfit object |
spot.cens |
Logical indicating whether to add tick marks to censor points |
surv.col |
A vector of colors for the survival curves |
cens.col |
A color for the censor ticks |
lty.est |
A vector of line types for the survival curves |
lty.ci |
A vector of line types for the confidence intervals |
lwd.est |
A vector of line widths for the survival curves |
lwd.ci |
A vector of line widths for the confidence intervals |
cens.chape |
A character string or number indicating what shape the censor indicator should be. |
black.white |
Logical indicating whether to use |
xlab,ylab,main |
Same as ggplot2 and base |
stratName |
A character string which overrides the name of the stratification variable (optional for prettyification). |
groupNames |
A character vector renaming the levels of the stratification variable. These must be in the same order as the original factor levels (optional). |
groupNameLevels |
A character vector of the stratification variable levels in the order which you want them to appear. |
ylimit |
a vector giving the limits for plotting the y axis (default to c(0,1)). |
The plot is constructed from the survfit object by accessing the internal structure of the fit and plotting a curve for each strata and confidence interval if desired.
Dominic LaRoche (adapted from Edwin Thoen)
1 2 3 4 5 6 7 8 | require(survival)
require(ggplot2)
data(BDSSRecurrenceExample)
dat <- BDSSRecurrenceExample
dat$Rec<-ifelse(dat$Recur=="recurred",1,0)
sv<-Surv(dat$time,dat$Rec)
sv.fit<-survfit(sv~treated,data=dat)
ggSurvival(sv.fit,stratName="Treatment")+theme(legend.position="bottom")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.