Mercurial > repos > testtool > survival
view survival/survival.R @ 0:6cc0c5eb71b2 draft
Uploaded
author | testtool |
---|---|
date | Fri, 29 Sep 2017 18:11:27 -0400 |
parents | |
children | 5b70a33bf327 |
line wrap: on
line source
args <- commandArgs(trailingOnly = TRUE) input =args[1] fit = args[2] png = args[3] #fit a Kaplan-Meier and plot it input<-("test-data/input.csv") fit <- survfit(Surv(obsT, status) ~ X1, type="kaplan-meier", conf.type="log", data=read.csv(input)) res <- summary(fit,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") png("fit.png") plot(fit) dev.off()