comparison survival/survival.R @ 20:b4d7a110dd32 draft

Uploaded
author testtool
date Mon, 02 Oct 2017 08:51:05 -0400
parents 744cf0f4d1b1
children ef13fa666e0e
comparison
equal deleted inserted replaced
19:d95c8e3b24e7 20:b4d7a110dd32
2 args <- commandArgs(trailingOnly = TRUE) 2 args <- commandArgs(trailingOnly = TRUE)
3 3
4 input = args[1] 4 input = args[1]
5 type = args[2] 5 type = args[2]
6 error = args[3] 6 error = args[3]
7 conf.type = args[4] 7 conf_type = args[4]
8 conf.lower = args[5] 8 conf_lower = args[5]
9 fit = args[6] 9 fit = args[6]
10 png = args[7] 10 png = args[7]
11 11
12 tofit <- survival::survfit(Surv(obsT, status) ~ X1, type = type, error = error, conf.type = conf.type , conf.lower = conf.lower, data = read.csv(input)) 12 tofit <- survival::survfit(Surv(obsT, status) ~ X1, type = type, error = error, conf.type = conf_type , conf.lower = conf_lower, data = read.csv(input))
13 13
14 res <- summary(tofit,times=c(1,2,3)) 14 res <- summary(tofit,times=c(1,2,3))
15 save.df <- as.data.frame(res[c("strata", "time", "n.risk", "n.event", "surv", "std.err", "lower", "upper")]) 15 save.df <- as.data.frame(res[c("strata", "time", "n.risk", "n.event", "surv", "std.err", "lower", "upper")])
16 write.csv(save.df, fit) 16 write.csv(save.df, fit)
17 17