Mercurial > repos > testtool > survival
changeset 1:5b70a33bf327 draft
Uploaded
author | testtool |
---|---|
date | Fri, 29 Sep 2017 18:32:23 -0400 |
parents | 6cc0c5eb71b2 |
children | ce6df2bd21cd |
files | survival/survival.R |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/survival/survival.R Fri Sep 29 18:11:27 2017 -0400 +++ b/survival/survival.R Fri Sep 29 18:32:23 2017 -0400 @@ -1,3 +1,4 @@ +require(survival, quietly = TRUE) args <- commandArgs(trailingOnly = TRUE) input =args[1] @@ -6,7 +7,7 @@ #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)) +fit <- survival::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")])