data(dataDIVAT5)
# Kaplan Meier estimations of the graft survival in the first center
plot(dataDIVAT5$year[dataDIVAT5$centre.num==1],
dataDIVAT5$surv[dataDIVAT5$centre.num==1],
xlab="Post transplantation time (years)", ylab="Graft survival",
ylim=c(0.7,1), xlim=c(0, 9), type="n")
# Goup 1
lines(c(0, dataDIVAT5$year[dataDIVAT5$centre.num==1 &
dataDIVAT5$classe==1]),
c(1, dataDIVAT5$surv[dataDIVAT5$centre.num==1 &
dataDIVAT5$classe==1]),
type="b", col=1, lty=1, lwd=2)
# Goup 2
lines(c(0, dataDIVAT5$year[dataDIVAT5$centre.num==1 &
dataDIVAT5$classe==2]),
c(1, dataDIVAT5$surv[dataDIVAT5$centre.num==1 &
dataDIVAT5$classe==2]),
type="b", col=2, lty=2, lwd=2)
# legend
legend("bottomleft", c("group #1 (1-year Cr<4.57)",
"group #2 (1-year Cr>4.57)"), col=c(1, 2),
lty=c(1, 2), lwd=c(2, 2))
Run the code above in your browser using DataLab