changeset 2:ce6df2bd21cd draft

Uploaded
author testtool
date Fri, 29 Sep 2017 18:41:35 -0400
parents 5b70a33bf327
children e31c47bf46a4
files survival/survival.R
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/survival/survival.R	Fri Sep 29 18:32:23 2017 -0400
+++ b/survival/survival.R	Fri Sep 29 18:41:35 2017 -0400
@@ -5,15 +5,13 @@
 fit = args[2]
 png = args[3]
 
-#fit a Kaplan-Meier and plot it
-input<-("test-data/input.csv")
-fit <- survival::survfit(Surv(obsT, status) ~ X1, type="kaplan-meier", conf.type="log", data=read.csv(input))
+tofit <- survival::survfit(Surv(obsT, status) ~ X1, type="kaplan-meier", conf.type="log", data=read.csv(input))
 
-res <- summary(fit,times=c(1,2,3))
+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, file = "survfit.csv")
+write.csv(save.df, fit)
 
-png("fit.png")
-plot(fit)
+png(png)
+plot(tofit)
 dev.off()