Files
AMR/man/sir_combine.Rd
T

101 lines
6.3 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sir_combine.R
\name{sir_combine}
\alias{sir_combine}
\title{Combine SIR Results of Multiple Antimicrobials}
\usage{
sir_combine(
...,
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
}
\arguments{
\item{...}{Two or more vectors (or columns) with antimicrobial interpretations, or a data frame with such columns. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed. All vectors must be of the same length.}
\item{only_all_tested}{A \link{logical} to indicate that isolates must be tested for all antimicrobials. If \code{TRUE}, the result is \code{NA} for isolates with a missing result for any of the antimicrobials. If \code{FALSE} (default), a missing result only leads to \code{NA} if a result for the missing antimicrobial could have changed the result of the combination, see \emph{Combination Therapy} below.}
\item{guideline}{Either \code{"EUCAST"} (default) or \code{"CLSI"}, to determine whether the 'I' category is considered susceptible. This only affects isolates with a missing result for any of the antimicrobials when \code{only_all_tested = FALSE}, see \emph{Combination Therapy} below. The default can be changed with the \code{AMR_guideline} option, see \link{AMR-options}.}
}
\value{
A \code{\link{sir}} vector with the same length as the input.
}
\description{
Combine the SIR results of two or more antimicrobials into one SIR result per isolate, e.g. to create a variable for the combination therapy of piperacillin/tazobactam with gentamicin. The result is the best result of the antimicrobials, as a combination therapy covers the isolate if any of its antimicrobials is active. See \emph{Combination Therapy} below for the exact rules.
The same rules are used by \code{\link[=antibiogram]{antibiogram()}} and \code{\link[=wisca]{wisca()}} for combination antibiograms, and by the \code{\link[=count]{count_*()}} and \code{\link[=proportion]{proportion_*()}} functions when more than one variable is used, so the result of \code{\link[=sir_combine]{sir_combine()}} can be used in any further analysis.
}
\section{Combination Therapy}{
A combination of antimicrobials is considered as good as its most active antimicrobial: \code{"S"} is preferred over \code{"WT"}, and \code{"R"} over \code{"NWT"} and \code{"NS"}. The value \code{"NI"} (non-interpretable) is considered a missing result.
A missing result can only be ignored if the result of the combination is susceptible regardless of the missing result, which depends on the \code{only_all_tested} argument and on the guideline: under EUCAST, the 'I' category is considered susceptible (\emph{susceptible, increased exposure}), and under CLSI, it is not.
This is an example for two antimicrobials, Drug A and Drug B (the order of the antimicrobials does not matter):
\if{html}{\out{<div class="sourceCode">}}\preformatted{-------------------------------------------------------------------------
Result of the combination
-----------------------------------------------------
Drug A Drug B only_all_tested = FALSE only_all_tested = TRUE
-------- -------- ---------------------------- ----------------------
S S, I, R S S
I I, R I I
R R R R
S <NA> S <NA>
I <NA> I (EUCAST), <NA> (CLSI) <NA>
R <NA> <NA> <NA>
<NA> <NA> <NA> <NA>
-------------------------------------------------------------------------
}\if{html}{\out{</div>}}
The \code{\link[=count]{count_*()}} and \code{\link[=proportion]{proportion_*()}} functions, such as \code{\link[=susceptibility]{susceptibility()}} and \code{\link[=resistance]{resistance()}}, apply exactly these rules when more than one variable is used: an isolate is considered tested if the result of the combination is not \code{NA}, and is then counted by the result of the combination. Consequently, \code{\link[=count_susceptible]{count_susceptible()}} \code{+} \code{\link[=count_resistant]{count_resistant()}} \code{=} \code{\link[=count_all]{count_all()}}, and \code{\link[=susceptibility]{susceptibility()}} \code{+} \code{\link[=resistance]{resistance()}} \verb{= 1}, for both values of \code{only_all_tested}. The guideline is taken from their \code{guideline} argument if they have one, and otherwise from the \code{AMR_guideline} option.
In \code{\link[=antibiogram]{antibiogram()}} and \code{\link[=wisca]{wisca()}}, the 'I' and 'SDD' categories are considered susceptible if \code{combine_SI = TRUE} (default), and the result of the combination is then reduced to S or R.
}
\examples{
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"))
sir_combine(drug_a, drug_b)
sir_combine(drug_a, drug_b, guideline = "CLSI")
sir_combine(drug_a, drug_b, only_all_tested = TRUE)
# 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)
\donttest{
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")) {
# 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)
)
}
}
}
\seealso{
\code{\link[=count]{count()}} and \code{\link[=proportion]{proportion()}} for counting and calculating susceptibility of (combinations of) antimicrobials, and \code{\link[=antibiogram]{antibiogram()}} for combination antibiograms.
}