1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-27 09:26:11 +01:00
AMR/man/as.rsi.Rd

116 lines
5.1 KiB
Plaintext
Raw Normal View History

2018-02-21 11:52:31 +01:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rsi.R
2018-02-21 11:52:31 +01:00
\name{as.rsi}
\alias{as.rsi}
2019-05-10 16:44:59 +02:00
\alias{as.rsi.mic}
\alias{as.rsi.disk}
\alias{as.rsi.data.frame}
2018-02-21 11:52:31 +01:00
\alias{is.rsi}
2018-08-22 00:02:26 +02:00
\alias{is.rsi.eligible}
2018-02-21 11:52:31 +01:00
\title{Class 'rsi'}
\usage{
2019-05-10 16:44:59 +02:00
as.rsi(x, ...)
\method{as.rsi}{mic}(x, mo, ab, guideline = "EUCAST", ...)
\method{as.rsi}{disk}(x, mo, ab, guideline = "EUCAST", ...)
\method{as.rsi}{data.frame}(x, col_mo = NULL, guideline = "EUCAST",
...)
2018-02-21 11:52:31 +01:00
is.rsi(x)
2018-08-22 00:02:26 +02:00
2019-02-04 12:24:07 +01:00
is.rsi.eligible(x, threshold = 0.05)
2018-02-21 11:52:31 +01:00
}
\arguments{
2019-05-10 16:44:59 +02:00
\item{x}{vector of values (for class \code{mic}: an MIC value in mg/L, for class \code{disk}: a disk diffusion radius in millimeters)}
\item{...}{parameters passed on to methods}
\item{mo}{a microorganism code, generated with \code{\link{as.mo}}}
\item{ab}{an antimicrobial code, generated with \code{\link{as.ab}}}
2019-05-10 16:44:59 +02:00
\item{guideline}{defaults to the latest included EUCAST guideline, run \code{unique(AMR::rsi_translation$guideline)} for all options}
2019-08-27 22:41:09 +02:00
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link{as.mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}.}
2019-02-04 12:24:07 +01:00
\item{threshold}{maximum fraction of invalid antimicrobial interpretations of \code{x}, see Examples}
2018-02-21 11:52:31 +01:00
}
\value{
2018-10-17 17:32:34 +02:00
Ordered factor with new class \code{rsi}
2018-02-21 11:52:31 +01:00
}
\description{
2019-05-10 16:44:59 +02:00
Interpret MIC values according to EUCAST or CLSI, or clean up existing RSI values. This transforms the input to a new class \code{rsi}, which is an ordered factor with levels \code{S < I < R}. Invalid antimicrobial interpretations will be translated as \code{NA} with a warning.
2018-02-21 11:52:31 +01:00
}
2018-08-22 00:02:26 +02:00
\details{
2019-05-10 16:44:59 +02:00
Run \code{unique(AMR::rsi_translation$guideline)} for a list of all supported guidelines.
2019-04-09 14:59:17 +02:00
After using \code{as.rsi}, you can use \code{\link{eucast_rules}} to (1) apply inferred susceptibility and resistance based on results of other antimicrobials and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
2019-05-10 16:44:59 +02:00
The function \code{is.rsi.eligible} returns \code{TRUE} when a columns contains at most 5\% invalid antimicrobial interpretations (not S and/or I and/or R), and \code{FALSE} otherwise. The threshold of 5\% can be set with the \code{threshold} parameter.
2018-08-22 00:02:26 +02:00
}
2019-05-13 10:10:16 +02:00
\section{Interpretation of S, I and R}{
In 2019, EUCAST has decided to change the definitions of susceptibility testing categories S, I and R as shown below (\url{http://www.eucast.org/newsiandr/}). Results of several consultations on the new definitions are available on the EUCAST website under "Consultations".
2019-05-13 10:10:16 +02:00
\itemize{
2019-05-23 16:58:59 +02:00
\item{\strong{S} - }{Susceptible, standard dosing regimen: A microorganism is categorised as "Susceptible, standard dosing regimen", when there is a high likelihood of therapeutic success using a standard dosing regimen of the agent.}
\item{\strong{I} - }{Susceptible, increased exposure: A microorganism is categorised as "Susceptible, Increased exposure" when there is a high likelihood of therapeutic success because exposure to the agent is increased by adjusting the dosing regimen or by its concentration at the site of infection.}
\item{\strong{R} - }{Resistant: A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.}
2019-05-13 10:10:16 +02:00
}
Exposure is a function of how the mode of administration, dose, dosing interval, infusion time, as well as distribution and excretion of the antimicrobial agent will influence the infecting organism at the site of infection.
This AMR package honours this new insight. Use \code{\link{portion_SI}} to determine antimicrobial susceptibility and \code{\link{count_SI}} to count susceptible isolates.
2019-05-13 10:10:16 +02:00
}
2019-01-02 23:24:07 +01:00
\section{Read more on our website!}{
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
2019-01-02 23:24:07 +01:00
}
2018-02-21 11:52:31 +01:00
\examples{
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
2018-02-22 20:48:48 +01:00
is.rsi(rsi_data)
2018-03-14 09:58:58 +01:00
2018-06-19 10:05:38 +02:00
# this can also coerce combined MIC/RSI values:
as.rsi("<= 0.002; S") # will return S
2018-06-19 10:05:38 +02:00
2019-05-10 16:44:59 +02:00
# interpret MIC values
as.rsi(x = as.mic(2),
mo = as.mo("S. pneumoniae"),
ab = "AMX",
guideline = "EUCAST")
as.rsi(x = as.mic(4),
mo = as.mo("S. pneumoniae"),
ab = "AMX",
guideline = "EUCAST")
2018-03-13 15:40:10 +01:00
plot(rsi_data) # for percentages
barplot(rsi_data) # for frequencies
2019-07-29 17:34:57 +02:00
library(clean)
2018-08-01 22:37:28 +02:00
freq(rsi_data) # frequency table with informative header
2018-08-22 00:02:26 +02:00
2018-12-07 12:04:55 +01:00
# using dplyr's mutate
2018-08-22 00:02:26 +02:00
library(dplyr)
example_isolates \%>\%
2019-05-10 16:44:59 +02:00
mutate_at(vars(PEN:RIF), as.rsi)
2018-12-07 12:04:55 +01:00
2019-02-04 12:24:07 +01:00
2018-12-07 12:04:55 +01:00
# fastest way to transform all columns with already valid AB results to class `rsi`:
example_isolates \%>\%
2018-08-22 00:02:26 +02:00
mutate_if(is.rsi.eligible,
as.rsi)
2019-02-04 12:24:07 +01:00
# default threshold of `is.rsi.eligible` is 5\%.
is.rsi.eligible(WHONET$`First name`) # fails, >80\% is invalid
2019-05-10 16:44:59 +02:00
is.rsi.eligible(WHONET$`First name`, threshold = 0.99) # succeeds
2018-02-21 11:52:31 +01:00
}
\seealso{
\code{\link{as.mic}}
}
2018-07-13 17:23:46 +02:00
\keyword{rsi}