Determine antimicrobial resistance (AMR) of all bug-drug combinations in your data set where at least 30 (default) isolates are available per species. Use format()
on the result to prettify it to a publishable/printable format, see Examples.
Usage
bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...)
# S3 method for bug_drug_combinations
format(
x,
translate_ab = "name (ab, atc)",
language = get_AMR_locale(),
minimum = 30,
combine_SI = TRUE,
add_ab_group = TRUE,
remove_intrinsic_resistant = FALSE,
decimal.mark = getOption("OutDec"),
big.mark = ifelse(decimal.mark == ",", ".", ","),
...
)
Source
M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition, 2022, Clinical and Laboratory Standards Institute (CLSI). https://clsi.org/standards/products/microbiology/documents/m39/.
Arguments
- x
a data set with antibiotic columns, such as
amox
,AMX
andAMC
- col_mo
column name of the IDs of the microorganisms (see
as.mo()
), defaults to the first column of classmo
. Values will be coerced usingas.mo()
.- FUN
the function to call on the
mo
column to transform the microorganism codes, defaults tomo_shortname()
- ...
arguments passed on to
FUN
- translate_ab
a character of length 1 containing column names of the antibiotics data set
- language
language of the returned text, defaults to system language (see
get_AMR_locale()
) and can also be set withgetOption("AMR_locale")
. Uselanguage = NULL
orlanguage = ""
to prevent translation.- minimum
the minimum allowed number of available (tested) isolates. Any isolate count lower than
minimum
will returnNA
with a warning. The default number of30
isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see Source.- combine_SI
a logical to indicate whether values S and I should be summed, so resistance will be based on only R, defaults to
TRUE
- add_ab_group
a logical to indicate where the group of the antimicrobials must be included as a first column
- remove_intrinsic_resistant
logical to indicate that rows and columns with 100% resistance for all tested antimicrobials must be removed from the table
- decimal.mark
the character to be used to indicate the numeric decimal point.
- big.mark
character; if not empty used as mark between every
big.interval
decimals before (hencebig
) the decimal point.
Value
The function bug_drug_combinations()
returns a data.frame with columns "mo", "ab", "S", "I", "R" and "total".
Details
The function format()
calculates the resistance per bug-drug combination. Use combine_SI = TRUE
(default) to test R vs. S+I and combine_SI = FALSE
to test R+I vs. S.
Examples
# \donttest{
x <- bug_drug_combinations(example_isolates)
#> ℹ Using column 'mo' as input for `col_mo`.
head(x)
#> # A tibble: 6 × 6
#> mo ab S I R total
#> <chr> <chr> <int> <int> <int> <int>
#> 1 (unknown species) PEN 14 0 1 15
#> 2 (unknown species) OXA 0 0 1 1
#> 3 (unknown species) FLC 0 0 0 0
#> 4 (unknown species) AMX 15 0 1 16
#> 5 (unknown species) AMC 15 0 0 15
#> 6 (unknown species) AMP 15 0 1 16
#> Use 'format()' on this result to get a publishable/printable format.
format(x, translate_ab = "name (atc)")
#> # A tibble: 39 × 12
#> Group Drug CoNS E. co…¹ E. fa…² K. pn…³ P. ae…⁴ P. mi…⁵ S. au…⁶ S. ep…⁷
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 "Aminogl… Amik… "100… " 0.0… "100.0… "" "" "" "" "100.0…
#> 2 "" Gent… " 13… " 2.0… "100.0… " 10.3… " 0.0… " 5.9… " 0.9… " 21.5…
#> 3 "" Kana… "100… "" "100.0… "" "100.0… "" "" "100.0…
#> 4 "" Tobr… " 78… " 2.6… "100.0… " 10.3… " 0.0… " 5.9… " 2.3… " 49.4…
#> 5 "Ampheni… Chlo… "" "" "" "" "100.0… "" " 0.0… " 3.1…
#> 6 "Antimyc… Rifa… "" "100.0… "" "100.0… "100.0… "100.0… " 0.0… " 2.7…
#> 7 "Beta-la… Amox… " 93… " 50.0… "" "100.0… "100.0… "" " 93.9… " 98.9…
#> 8 "" Amox… " 42… " 13.1… "" " 10.3… "100.0… " 2.8… " 0.4… " 54.5…
#> 9 "" Ampi… " 93… " 50.0… "" "100.0… "100.0… "" " 93.9… " 98.9…
#> 10 "" Benz… " 77… "100.0… "" "100.0… "100.0… "100.0… " 80.9… " 89.4…
#> # … with 29 more rows, 2 more variables: `S. hominis` <chr>,
#> # `S. pneumoniae` <chr>, and abbreviated variable names ¹`E. coli`,
#> # ²`E. faecalis`, ³`K. pneumoniae`, ⁴`P. aeruginosa`, ⁵`P. mirabilis`,
#> # ⁶`S. aureus`, ⁷`S. epidermidis`
# Use FUN to change to transformation of microorganism codes
bug_drug_combinations(example_isolates,
FUN = mo_gramstain
)
#> ℹ Using column 'mo' as input for `col_mo`.
#> # A tibble: 80 × 6
#> mo ab S I R total
#> * <chr> <chr> <int> <int> <int> <int>
#> 1 Gram-negative PEN 17 1 726 744
#> 2 Gram-negative OXA 9 0 1 10
#> 3 Gram-negative FLC 11 0 1 12
#> 4 Gram-negative AMX 231 1 407 639
#> 5 Gram-negative AMC 473 89 175 737
#> 6 Gram-negative AMP 231 1 407 639
#> 7 Gram-negative TZP 556 11 76 643
#> 8 Gram-negative CZO 94 2 110 206
#> 9 Gram-negative FEP 470 1 14 485
#> 10 Gram-negative CXM 546 22 144 712
#> # … with 70 more rows
#> Use 'format()' on this result to get a publishable/printable format.
bug_drug_combinations(example_isolates,
FUN = function(x) {
ifelse(x == as.mo("Escherichia coli"),
"E. coli",
"Others"
)
}
)
#> ℹ Using column 'mo' as input for `col_mo`.
#> # A tibble: 80 × 6
#> mo ab S I R total
#> * <chr> <chr> <int> <int> <int> <int>
#> 1 E. coli PEN 0 0 467 467
#> 2 E. coli OXA 0 0 0 0
#> 3 E. coli FLC 0 0 0 0
#> 4 E. coli AMX 196 0 196 392
#> 5 E. coli AMC 332 74 61 467
#> 6 E. coli AMP 196 0 196 392
#> 7 E. coli TZP 388 5 23 416
#> 8 E. coli CZO 79 1 2 82
#> 9 E. coli FEP 308 0 9 317
#> 10 E. coli CXM 425 15 25 465
#> # … with 70 more rows
#> Use 'format()' on this result to get a publishable/printable format.
# }