byGroupHR.boxplot: Hazard ratio boxplots

Description Usage Arguments Author(s) See Also Examples

View source: R/LOSplotFns.R

Description

Boxplot of hazard ratio by specified groups.

Usage

1
byGroupHR.boxplot(res2, model)

Arguments

res2

Of format table2()

model

Particular model type; either naive, subdistribution or cause-specific.

Author(s)

N Green

See Also

HRboxplot.batch, ~~~

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
##---- 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 (res2, model) 
{
    namesGroup.short <- c("CoNS", "Other", "Non-p. Streptococci", 
        expression(italic("S. aureus")), expression(paste(italic("Enterococcus"), 
            plain(spp.))), expression(italic("E. Coli")), expression(paste(italic("Klebsiella"), 
            plain(spp.))), expression(paste(italic("Enterobacter"), 
            plain(spp.))), "Gram-negative", "Gram-positive", 
        "All")
    col <- grep(model, names(res2))
    if (model == "atime HR") {
        model <- "Discharge with time to infection only"
    }
    if (model == "afull HR") {
        model <- "Discharge with full set of covariates"
    }
    if (model == "dtime HR") {
        model <- "Death with time to infection only"
    }
    if (model == "dfull HR") {
        model <- "Death with full set of covariates"
    }
    model <- ""
    neworder <- c(11, 10, 9, 1, 6, 8, 5, 7, 3, 4, 2)
    wmeans <- as.numeric(res2[, col])[neworder]
    liw <- as.numeric(res2[, col + 1])[neworder]
    uiw <- as.numeric(res2[, col + 2])[neworder]
    par(mar = c(10, 4, 2, 0.5))
    plotCI(barplot(wmeans, col = "blue", ylim = c(0, min(10, 
        max(uiw, rm.na = TRUE))), names = namesGroup.short[neworder], 
        las = 2, main = model, ylab = "Hazard ratio"), wmeans, 
        uiw = uiw - wmeans, liw = wmeans - liw, add = TRUE)
    abline(h = 1, lty = 2, col = "red")
  }

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