Mercurial > repos > testtool > survival
view survival/survival.R @ 2:ce6df2bd21cd draft
Uploaded
author | testtool |
---|---|
date | Fri, 29 Sep 2017 18:41:35 -0400 |
parents | 5b70a33bf327 |
children | 744cf0f4d1b1 |
line wrap: on
line source
require(survival, quietly = TRUE) args <- commandArgs(trailingOnly = TRUE) input =args[1] fit = args[2] png = args[3] tofit <- survival::survfit(Surv(obsT, status) ~ X1, type="kaplan-meier", conf.type="log", 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) dev.off()