1 | summaryTableAll(survData)
|
survData |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (survData)
{
survData.mix <- survData[survData$infstatus == 0, ]
survData.inf <- survData[survData$infstatus == 1, ]
out <- rbind(c(format(nrow(survData.inf), nsmall = 1), round(nrow(survData.inf)/nrow(survData),
3), round(nrow(survData.mix)), round(nrow(survData.mix)/nrow(survData),
3), round(nrow(survData)), 1), c(paste(round(mean(survData.inf$age)),
"/", median(survData.inf$age)), round(sd(survData.inf$age)),
paste(round(mean(survData.mix$age)), "/", median(survData.mix$age)),
round(sd(survData.mix$age)), paste(round(mean(survData$age)),
"/", median(survData$age)), round(sd(survData$age))),
c(paste(round(mean(survData.inf$time)), "/", median(survData.inf$time)),
round(sd(survData.inf$time)), paste(round(mean(survData.mix$time,
na.rm = T)), "/", median(survData.mix$time, na.rm = T)),
round(sd(survData.mix$time, na.rm = T)), paste(round(mean(survData$time,
na.rm = T)), "/", median(survData$time, na.rm = T)),
round(sd(survData$time, na.rm = T))), c(paste(round(mean(survData.inf$spectime)),
"/", median(survData.inf$spectime)), round(sd(survData.inf$spectime)),
paste(round(mean(survData.mix$spectime)), "/", median(survData.mix$spectime)),
round(sd(survData.mix$spectime)), paste(round(mean(survData$spectime)),
"/", median(survData$spectime)), round(sd(survData$spectime))),
c(round(table(survData.inf$event)[2]), round(table(survData.inf$event)[2]/(table(survData.inf$event)[2] +
table(survData.inf$event)[1]), 2), round(table(survData.mix$event)[2]),
round(table(survData.mix$event)[2]/(table(survData.mix$event)[2] +
table(survData.mix$event)[1]), 2), round(table(survData$event)[2]),
round(table(survData$event)[2]/(table(survData$event)[2] +
table(survData$event)[1]), 3)), c(round(table(survData.inf$gender)[1]),
round(table(survData.inf$gender)[1]/(table(survData.inf$gender)[1] +
table(survData.inf$gender)[2]), 2), round(table(survData.mix$gender)[1]),
round(table(survData.mix$gender)[1]/(table(survData.mix$gender)[1] +
table(survData.mix$gender)[2]), 2), round(table(survData$gender)[1]),
round(table(survData$gender)[1]/(table(survData$gender)[1] +
table(survData$gender)[2]), 2)))
rownames(out) <- c("Sample size", "Ages (years)", "LOS (days)",
"Inf times (days)", "Deaths", "Sex (F)")
colnames(out) <- c("HA-BSI", "%", "Non-HA-BSI", "%", "All",
"%")
return(pandoc.table(out, caption = "caption:...", style = "grid",
split.tables = Inf, justify = "left"))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.