table3.HR: More condensed table format of hazard ratio values for...

Description Usage Arguments See Also Examples

View source: R/tableFns.R

Description

One of several output formats. This format is used in the Journal of Pediatric Infectious Diseases Society (JPIDS) paper.

Usage

1
table3.HR(res, hrtype)

Arguments

res
hrtype

See Also

table.HR,table2.HR

Examples

 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
##---- 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 (res, hrtype) 
{
    if (hrtype == "timedeptsubdistn") {
        colNames <- c("Organism", "Disch Time-adjusted", "Disch Fully adjusted", 
            "Death Time-adjusted", "Death Fully adjusted")
    }
    else if (hrtype == "naive") {
        colNames <- c("Organism", "Disch", "Death", "Both")
    }
    else if (hrtype == "timedeptcausespec") {
        colNames <- c("Organism", "Disch Time-adjusted", "Disch Fully adjusted", 
            "Death Time-adjusted", "Death Fully adjusted", "Both Time-adjusted", 
            "Both Fully adjusted")
    }
    else {
        stop("type unidentified")
    }
    res.new <- data.frame(matrix(ncol = length(colNames)))
    colnames(res.new) <- colNames
    for (name in unique(res$organism)) {
        whichrows <- which(res$organism == name & res$method == 
            hrtype)
        rowTotal <- NULL
        for (j in 1:length(whichrows)) {
            temp <- paste(res[whichrows[j], "exp(beta)"], " (", 
                res[whichrows[j], "Lower CI"], ", ", res[whichrows[j], 
                  "Upper CI"], ")", sep = "")
            rowTotal <- c(rowTotal, temp)
        }
        res.new <- rbind(res.new, c(name, rowTotal))
    }
    res.new <- res.new[!is.na(res.new[, 1]), ]
    res.new
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.