This is an example R Markdown file to show the use of antibiogram() of the AMR package.

For starters, this is what our example_isolates data set looks like:

example_isolates
## # A tibble: 2,000 × 46
##    date       patient   age gender ward     mo           PEN   OXA   FLC   AMX  
##    <date>     <chr>   <dbl> <chr>  <chr>    <mo>         <sir> <sir> <sir> <sir>
##  1 2002-01-02 A77334     65 F      Clinical B_ESCHR_COLI R     NA    NA    NA   
##  2 2002-01-03 A77334     65 F      Clinical B_ESCHR_COLI R     NA    NA    NA   
##  3 2002-01-07 067927     45 F      ICU      B_STPHY_EPDR R     NA    R     NA   
##  4 2002-01-07 067927     45 F      ICU      B_STPHY_EPDR R     NA    R     NA   
##  5 2002-01-13 067927     45 F      ICU      B_STPHY_EPDR R     NA    R     NA   
##  6 2002-01-13 067927     45 F      ICU      B_STPHY_EPDR R     NA    R     NA   
##  7 2002-01-14 462729     78 M      Clinical B_STPHY_AURS R     NA    S     R    
##  8 2002-01-14 462729     78 M      Clinical B_STPHY_AURS R     NA    S     R    
##  9 2002-01-16 067927     45 F      ICU      B_STPHY_EPDR R     NA    R     NA   
## 10 2002-01-17 858515     79 F      ICU      B_STPHY_EPDR R     NA    S     NA   
## # … with 1,990 more rows, and 36 more variables: AMC <sir>, AMP <sir>,
## #   TZP <sir>, CZO <sir>, FEP <sir>, CXM <sir>, FOX <sir>, CTX <sir>,
## #   CAZ <sir>, CRO <sir>, GEN <sir>, TOB <sir>, AMK <sir>, KAN <sir>,
## #   TMP <sir>, SXT <sir>, NIT <sir>, FOS <sir>, LNZ <sir>, CIP <sir>,
## #   MFX <sir>, VAN <sir>, TEC <sir>, TCY <sir>, TGC <sir>, DOX <sir>,
## #   ERY <sir>, CLI <sir>, AZM <sir>, IPM <sir>, MEM <sir>, MTR <sir>,
## #   CHL <sir>, COL <sir>, MUP <sir>, RIF <sir>

Traditional Antibiogram

print(
  antibiogram(example_isolates,
              antibiotics = c(aminoglycosides(), carbapenems()))
)
Pathogen (N min-max) AMK GEN IPM KAN MEM TOB
CoNS (43-309) 0 86 52 0 52 22
E. coli (0-462) 100 98 100 NA 100 97
E. faecalis (0-39) 0 0 100 0 NA 0
K. pneumoniae (0-58) NA 90 100 NA 100 90
P. aeruginosa (17-30) NA 100 NA 0 NA 100
P. mirabilis (0-34) NA 94 94 NA NA 94
S. aureus (2-233) NA 99 NA NA NA 98
S. epidermidis (8-163) 0 79 NA 0 NA 51
S. hominis (3-80) NA 92 NA NA NA 85
S. pneumoniae (11-117) 0 0 NA 0 NA 0

Combined Antibiogram

print(
  antibiogram(example_isolates,
              antibiotics = c("TZP", "TZP+TOB", "TZP+GEN"))
)
Pathogen (N min-max) TZP TZP + GEN TZP + TOB
CoNS (29-274) 30 97 NA
E. coli (416-461) 94 100 99
K. pneumoniae (53-58) 89 93 93
P. aeruginosa (27-30) NA 100 100
P. mirabilis (27-34) NA 100 100
S. aureus (7-231) NA 100 100
S. epidermidis (5-128) NA 100 100
S. hominis (0-74) NA 100 100
S. pneumoniae (112-112) 100 100 100

Syndromic Antibiogram

print(
  antibiogram(example_isolates,
              antibiotics = c(aminoglycosides(), carbapenems()),
              syndromic_group = "ward")
)
Syndromic Group Pathogen (N min-max) AMK GEN IPM KAN MEM TOB
Clinical CoNS (23-205) NA 89 57 NA 57 26
ICU CoNS (10-73) NA 79 NA NA NA NA
Outpatient CoNS (3-31) NA 84 NA NA NA NA
Clinical E. coli (0-299) 100 98 100 NA 100 98
ICU E. coli (0-137) 100 99 100 NA 100 96
Clinical K. pneumoniae (0-51) NA 92 100 NA 100 92
Clinical P. mirabilis (0-30) NA 100 NA NA NA 100
Clinical S. aureus (2-150) NA 99 NA NA NA 97
ICU S. aureus (0-66) NA 100 NA NA NA NA
Clinical S. epidermidis (4-79) NA 82 NA NA NA 55
ICU S. epidermidis (4-75) NA 72 NA NA NA 41
Clinical S. hominis (1-45) NA 96 NA NA NA 94
Clinical S. pneumoniae (5-78) 0 0 NA 0 NA 0
ICU S. pneumoniae (5-30) 0 0 NA 0 NA 0

Weighted-Incidence Syndromic Combination Antibiogram (WISCA)

print(
  antibiogram(example_isolates,
              antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
              mo_transform = "gramstain",
              minimum = 10, # this should be >= 30, but now just as example
              syndromic_group = ifelse(example_isolates$age >= 65 &
                                         example_isolates$gender == "M",
                                       "WISCA Group 1", "WISCA Group 2"))
)
Syndromic Group Pathogen (N min-max) AMC AMC + CIP TZP TZP + TOB
WISCA Group 1 Gram-negative (261-285) 76 95 89 99
WISCA Group 2 Gram-negative (380-442) 76 98 88 98
WISCA Group 1 Gram-positive (123-406) 76 89 81 95
WISCA Group 2 Gram-positive (222-732) 76 89 88 95