fplot.surv | R Documentation |
Plot Kaplan-Meier Curves with number at risk and number censored at bottom
fplot.surv(smdl.yt = "Mths.OS", smdl.ye = "OS", smdl.x = "", xnames = "", xlab = "Months", ylab = "Overall Survival (%)", dat = dat.work, t.at = NULL, lty = 1, mar = c(4, 3.5, 0.5, 0.5), mgp = c(2, 0.8, 0), nr.line = 3, nr.xadj = 0.75, nr.yadj = 0.8, loc.legend = "bottomleft", loc.p = "topright")
smdl.yt |
survival time |
smdl.ye |
event |
smdl.x |
a covariate |
xnames |
group names of the covariate x |
xlab |
label of x-axis |
ylab |
label of y-axis |
dat |
data |
t.at |
location of the x-axis tick marks |
mar |
margin parameters |
mgp |
mgp parameters |
nr.line |
lines from the x-axis for the number at risk texts |
nr.xadj |
adjustment along x-axis for the NR(NC) notation as a fraction of the length of the second tick mark from 0 |
nr.yadj |
adjustment along y-axis for the NR(NC) notation |
loc.legend |
location of the legend |
loc.p |
location of the p-value |
survfit output, median survival and coxph output if there is a covariate x
set.seed(16) dat.work <- data.frame(StudyID=1:40, Death = sample(c(0,1), 40, replace=T, p=c(0.2, 0.8)), Mths.OS = 10*rexp(40, rate=0.5), Group = factor(rep(c("grp1", "grp2"), c(15,25)))) out <- fplot.surv(smdl.yt = "Mths.OS", smdl.ye = "Death", xlab = "Months", ylab = "Overall Survival (%)", dat = dat.work, mar=c(4.0,3.5,0.5,0.7), mgp = c(2.0, 0.8, 0), nr.line = 3, nr.xadj = 0.4, nr.yadj = 0.8) out <- fplot.surv(smdl.yt = "Mths.OS", smdl.ye = "Death", smdl.x = "Group", xnames = c("Group1", "Group2"), xlab = "Months", ylab = "Overall Survival (%)", dat=dat.work, t.at = NULL, lty=NULL, mar = c(4.0,3.5,0.5,0.7), mgp = c(2.0, 0.8, 0), nr.line = 3, nr.xadj = 0.4, nr.yadj = 0.8, loc.legend = "bottomleft", loc.p = "topright")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.