pdf("ex0901.pdf") ex0901dat <- read.fwf("http://www.stat.ufl.edu/~winner/data/biostat/ex0901.dat", width=c(8,8,8), col.names=c("regimen", "time", "censor")) ex0901 <- data.frame(ex0901dat) attach(ex0901) # Load the survival analysis package library(survival) # Print out the survival times, censored values have a "+" next to them (Surv must be spelled exactly this way) Surv(time, censor==0) # Obtain survival tables and curves by regimen surv.byreg <- survfit(Surv(time, censor==0)~regimen) summary(surv.byreg) plot(surv.byreg) # Conduct the Log-Rank test to compare survival curves survdiff(Surv(time,censor==0)~regimen) dev.off()