# HG changeset patch # User testtool # Date 1506945265 14400 # Node ID 744cf0f4d1b1268a1b7921bed704cba494b7a99c # Parent e31c47bf46a4b78a4f228a188940507db4606de0 Uploaded diff -r e31c47bf46a4 -r 744cf0f4d1b1 survival/survival.R --- a/survival/survival.R Mon Oct 02 07:54:12 2017 -0400 +++ b/survival/survival.R Mon Oct 02 07:54:25 2017 -0400 @@ -1,17 +1,23 @@ require(survival, quietly = TRUE) args <- commandArgs(trailingOnly = TRUE) -input =args[1] -fit = args[2] -png = args[3] +input = args[1] +type = args[2] +error = args[3] +conf.type = args[4] +conf.lower = args[5] +fit = args[6] +png = args[7] -tofit <- survival::survfit(Surv(obsT, status) ~ X1, type="kaplan-meier", conf.type="log", data=read.csv(input)) +tofit <- survival::survfit(Surv(obsT, status) ~ X1, type = type, error = error, conf.type = conf.type , conf.lower = conf.lower, data = read.csv(input)) res <- summary(tofit,times=c(1,2,3)) save.df <- as.data.frame(res[c("strata", "time", "n.risk", "n.event", "surv", "std.err", "lower", "upper")]) write.csv(save.df, fit) png(png) -plot(tofit) +plot(tofit,xlab="Survival (days)", ylab="Survival", lwd=2,xlim=c(0,1900),ylim=c(0.3,1),col=c("red","blue")) +legend("topright",legend=c("low","high"),lty=c(1,1), + lwd=c(2.5,2.5),col=c("red","blue")) dev.off()