mirror of
https://github.com/msberends/AMR.git
synced 2025-07-17 23:13:14 +02:00
new antibiotics
This commit is contained in:
@ -2,18 +2,38 @@
|
||||
% Please edit documentation in R/rsi.R
|
||||
\name{as.rsi}
|
||||
\alias{as.rsi}
|
||||
\alias{as.rsi.mic}
|
||||
\alias{as.rsi.disk}
|
||||
\alias{as.rsi.data.frame}
|
||||
\alias{is.rsi}
|
||||
\alias{is.rsi.eligible}
|
||||
\title{Class 'rsi'}
|
||||
\usage{
|
||||
as.rsi(x)
|
||||
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",
|
||||
...)
|
||||
|
||||
is.rsi(x)
|
||||
|
||||
is.rsi.eligible(x, threshold = 0.05)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{vector}
|
||||
\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 antibiotic code, generated with \code{\link{as.ab}}}
|
||||
|
||||
\item{guideline}{defaults to the latest included EUCAST guideline, run \code{unique(AMR::rsi_translation$guideline)} for all options}
|
||||
|
||||
\item{col_mo}{column name of the unique IDs of the microorganisms (see \code{\link{mo}}), defaults to the first column of class \code{mo}. Values will be coerced using \code{\link{as.mo}}.}
|
||||
|
||||
\item{threshold}{maximum fraction of \code{x} that is allowed to fail transformation, see Examples}
|
||||
}
|
||||
@ -21,12 +41,14 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
Ordered factor with new class \code{rsi}
|
||||
}
|
||||
\description{
|
||||
This transforms a vector 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.
|
||||
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.
|
||||
}
|
||||
\details{
|
||||
\strong{NOTE:} This function does not translate MIC values to RSI values. If more than 50\% of the input resembles MIC values, it will warn about this.\cr You can use \code{\link{eucast_rules}} to (1) apply inferred susceptibility and resistance based on results of other antibiotics and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
|
||||
Run \code{unique(AMR::rsi_translation$guideline)} for a list of all supported guidelines.
|
||||
|
||||
The function \code{is.rsi.eligible} returns \code{TRUE} when a columns contains only valid antimicrobial interpretations (S and/or I and/or R), and \code{FALSE} otherwise.
|
||||
After using \code{as.rsi}, you can use \code{\link{eucast_rules}} to (1) apply inferred susceptibility and resistance based on results of other antibiotics and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
|
||||
|
||||
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.
|
||||
}
|
||||
\section{Read more on our website!}{
|
||||
|
||||
@ -41,6 +63,16 @@ is.rsi(rsi_data)
|
||||
# this can also coerce combined MIC/RSI values:
|
||||
as.rsi("<= 0.002; S") # will return S
|
||||
|
||||
# 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")
|
||||
|
||||
plot(rsi_data) # for percentages
|
||||
barplot(rsi_data) # for frequencies
|
||||
freq(rsi_data) # frequency table with informative header
|
||||
@ -48,7 +80,7 @@ freq(rsi_data) # frequency table with informative header
|
||||
# using dplyr's mutate
|
||||
library(dplyr)
|
||||
septic_patients \%>\%
|
||||
mutate_at(vars(peni:rifa), as.rsi)
|
||||
mutate_at(vars(PEN:RIF), as.rsi)
|
||||
|
||||
|
||||
# fastest way to transform all columns with already valid AB results to class `rsi`:
|
||||
@ -58,7 +90,7 @@ septic_patients \%>\%
|
||||
|
||||
# default threshold of `is.rsi.eligible` is 5\%.
|
||||
is.rsi.eligible(WHONET$`First name`) # fails, >80\% is invalid
|
||||
is.rsi.eligible(WHONET$`First name`, threshold = 0.9) # succeeds
|
||||
is.rsi.eligible(WHONET$`First name`, threshold = 0.99) # succeeds
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{as.mic}}
|
||||
|
Reference in New Issue
Block a user