| sir_combine | R Documentation |
Combine the SIR results of two or more antimicrobials into one SIR result per isolate. This can answer two different questions, set with the method argument:
"most_susceptible" (default): Is at least one of these antimicrobials expected to work? This is the result of a combination therapy, e.g. piperacillin/tazobactam with gentamicin, which covers the isolate if any of its antimicrobials is active.
"most_resistant": Is resistance demonstrated to any of these antimicrobials? This is the result for a group of antimicrobials, e.g. resistance to third-generation cephalosporins if an isolate is resistant to ceftazidime or ceftriaxone, as used in surveillance reports.
See Combination Therapy below for the exact rules. The same rules are used by antibiogram() and wisca() for combination antibiograms, and by the count_*() and proportion_*() functions when more than one variable is used.
sir_combine(
...,
method = c("most_susceptible", "most_resistant"),
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
... |
Two or more vectors (or columns) with antimicrobial interpretations, or a data frame with such columns. They will be transformed internally with |
method |
Either |
only_all_tested |
A logical to indicate that isolates must be tested for all antimicrobials. If |
guideline |
A guideline name, |
A sir vector with the same length as the input.
Results are ordered from susceptible to resistant: S (and WT), SDD, I, R (and NWT, NS). With method = "most_susceptible" (in sir_combine()), the most susceptible result of the antimicrobials is returned, and with method = "most_resistant", the most resistant result. The value "NI" (non-interpretable) is considered a missing result.
A missing result can only be ignored if it cannot change the conclusion: a susceptible result for "most_susceptible", and a non-susceptible result for "most_resistant". Under EUCAST, the 'I' category is considered susceptible (susceptible, increased exposure), and under CLSI, it is not. With only_all_tested = TRUE, any missing result leads to NA.
This is an example for two antimicrobials, Drug A and Drug B, under EUCAST (the order of the antimicrobials does not matter):
-------------------------------------------------------------------------
Result of method = Result of method =
"most_susceptible" "most_resistant"
----------------------- -----------------------------
only_all_tested = only_all_tested =
Drug A Drug B FALSE TRUE FALSE TRUE
-------- -------- --------- --------- ----------- -------------
S S S S S S
S I S S I I
S R S S R R
I R I I R R
R R R R R R
S <NA> S <NA> <NA> <NA>
I <NA> I <NA> <NA> <NA>
R <NA> <NA> <NA> R <NA>
<NA> <NA> <NA> <NA> <NA> <NA>
-------------------------------------------------------------------------
Under CLSI, the combination of I with a missing result is <NA> for "most_susceptible" and I for "most_resistant".
The count_*() and proportion_*() functions apply these rules when more than one variable is used. With only_all_tested = FALSE (default), the functions for susceptibility, such as susceptibility() and count_susceptible(), count an isolate as susceptible if any of the antimicrobials is susceptible ("most_susceptible"), and the functions for resistance, such as resistance() and count_resistant(), count an isolate as resistant if any of the antimicrobials is resistant ("most_resistant"). An isolate is considered tested if it has such a result, or if it was tested for all antimicrobials. Therefore, for combinations with only_all_tested = FALSE:
count_S() + count_I() + count_R() >= count_all() proportion_S() + proportion_I() + proportion_R() >= 1
With only_all_tested = TRUE, all these functions count the result of the combination therapy ("most_susceptible") of isolates tested for all antimicrobials, so that:
count_S() + count_I() + count_R() = count_all() proportion_S() + proportion_I() + proportion_R() = 1
In antibiogram() and wisca(), the result of the combination therapy ("most_susceptible") is used, the 'I' category is considered susceptible or not following the guideline argument ('SDD' is always considered susceptible), and the result is then reduced to S or R.
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R (https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/definition-of-s-i-and-r/).
In aggregated analyses, such as proportions, counts, antibiograms, and plots, the 'I' category must be considered either susceptible or resistant. In epidemiological AMR data analysis, this follows the guideline: EUCAST considers 'I' susceptible, while CLSI considers 'I' resistant. The dose-dependent susceptibility of CLSI ('SDD') is always considered susceptible, as it equals what EUCAST defines as 'I'. All functions with a guideline argument for this purpose use these categories:
guideline | Susceptible | Resistant |
"EUCAST" | S, SDD, I, WT | R, NWT, NS |
"CLSI" | S, SDD, WT | I, R, NWT, NS |
The values 'WT' (wild type) and 'NWT' (non-wild type) result from epidemiological cut-off values (ECOFFs) instead of clinical breakpoints. Since they are no clinical categories, 'WT' is always considered susceptible and 'NWT' always resistant, regardless of the guideline. The value 'NS' (non-susceptible) is always considered resistant, and 'NI' (non-interpretable) is always considered a missing result.
The guideline argument can be:
Left unset, to use the package option AMR_guideline, or "EUCAST" if this option is not set. In the latter case, a message is shown once per session (but not in R Markdown or Quarto documents); set the option to silence it.
"EUCAST", or any EUCAST version such as "EUCAST 2025", to consider 'I' susceptible, e.g., to return "SI" vs. "R" in proportion_df().
"CLSI", or any CLSI version such as "CLSI 2025", to consider 'I' resistant, e.g., to return "S" vs. "IR" in proportion_df().
NULL or FALSE, to keep S, I, and R separate. This is only possible in functions that return results per category: count_df(), proportion_df(), sir_df(), ggplot_sir(), geom_sir(), labels_sir_count(), and bug_drug_combinations(). Functions that return a single proportion or count, such as susceptibility(), count_resistant(), antibiogram(), wisca(), and format() on the result of bug_drug_combinations(), require 'I' to be considered either susceptible or resistant, and return an error.
Use susceptibility() and resistance() (or count_susceptible() and count_resistant()) to follow the guideline, or e.g. proportion_SI() and proportion_R() to be explicit regardless of the guideline.
The combine_SI argument of the functions that return results per category, antibiogram(), and wisca() is deprecated in favour of guideline. If set, it is followed literally and takes precedence over guideline.
count() and proportion() for counting and calculating susceptibility of (combinations of) antimicrobials, and antibiogram() for combination antibiograms.
drug_a <- as.sir(c("S", "R", "R", "I", "I", NA, "R", "SDD"))
drug_b <- as.sir(c("R", "S", "R", "R", NA, NA, NA, "I"))
# combination therapy: is at least one of them expected to work?
sir_combine(drug_a, drug_b)
sir_combine(drug_a, drug_b, guideline = "CLSI")
sir_combine(drug_a, drug_b, only_all_tested = TRUE)
# resistance within a group: is resistance demonstrated to any of them?
sir_combine(drug_a, drug_b, method = "most_resistant")
# the count and proportion functions use the same rules
susceptibility(drug_a, drug_b, minimum = 0)
susceptibility(sir_combine(drug_a, drug_b), minimum = 0)
resistance(drug_a, drug_b, minimum = 0)
resistance(sir_combine(drug_a, drug_b, method = "most_resistant"), minimum = 0)
if (require("dplyr")) {
# create a new variable for piperacillin/tazobactam + gentamicin
example_isolates %>%
filter(!is.na(TZP)) %>%
mutate(TZP_GEN = sir_combine(TZP, GEN)) %>%
select(mo, TZP, GEN, TZP_GEN)
}
if (require("dplyr")) {
# resistance to third-generation cephalosporins
example_isolates %>%
mutate(cephalosporins_3rd = sir_combine(CAZ, CRO, method = "most_resistant")) %>%
count(cephalosporins_3rd)
}
if (require("dplyr")) {
# combine any number of antimicrobials
example_isolates %>%
mutate(any_aminoglycoside = sir_combine(GEN, TOB, AMK, KAN)) %>%
count(any_aminoglycoside)
}
if (require("dplyr")) {
# use the new variable in further analyses
# THOUGH CONSIDER wisca() FOR RELIABLE ESTIMATES
example_isolates %>%
mutate(TZP_GEN = sir_combine(TZP, GEN)) %>%
group_by(ward) %>%
summarise(
TZP_mono = susceptibility(TZP),
GEN_mono = susceptibility(GEN),
TZP_GEN = susceptibility(TZP_GEN),
# or directly, without combining first:
TZP_GEN2 = susceptibility(TZP, GEN)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.