mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 23:21:56 +02:00
Replace RSI with SIR
This commit is contained in:
committed by
GitHub
parent
24b12024ce
commit
98e62c9af2
@ -1,8 +1,58 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/deprecated.R
|
||||
% Please edit documentation in R/zz_deprecated.R
|
||||
\docType{data}
|
||||
\name{AMR-deprecated}
|
||||
\alias{AMR-deprecated}
|
||||
\alias{NA_rsi_}
|
||||
\alias{as.rsi}
|
||||
\alias{facet_rsi}
|
||||
\alias{geom_rsi}
|
||||
\alias{ggplot_rsi}
|
||||
\alias{ggplot_rsi_predict}
|
||||
\alias{is.rsi}
|
||||
\alias{is.rsi.eligible}
|
||||
\alias{labels_rsi_count}
|
||||
\alias{n_rsi}
|
||||
\alias{random_rsi}
|
||||
\alias{rsi_df}
|
||||
\alias{rsi_predict}
|
||||
\alias{scale_rsi_colours}
|
||||
\alias{theme_rsi}
|
||||
\title{Deprecated Functions}
|
||||
\format{
|
||||
An object of class \code{rsi} (inherits from \code{ordered}, \code{factor}) of length 1.
|
||||
}
|
||||
\usage{
|
||||
NA_rsi_
|
||||
|
||||
as.rsi(x, ...)
|
||||
|
||||
facet_rsi(...)
|
||||
|
||||
geom_rsi(...)
|
||||
|
||||
ggplot_rsi(...)
|
||||
|
||||
ggplot_rsi_predict(...)
|
||||
|
||||
is.rsi(x, ...)
|
||||
|
||||
is.rsi.eligible(...)
|
||||
|
||||
labels_rsi_count(...)
|
||||
|
||||
n_rsi(...)
|
||||
|
||||
random_rsi(...)
|
||||
|
||||
rsi_df(...)
|
||||
|
||||
rsi_predict(...)
|
||||
|
||||
scale_rsi_colours(...)
|
||||
|
||||
theme_rsi(...)
|
||||
}
|
||||
\description{
|
||||
These functions are so-called '\link{Deprecated}'. \strong{They will be removed in a future release.} Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
|
||||
}
|
||||
|
32
man/AMR.Rd
32
man/AMR.Rd
@ -1,5 +1,5 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/amr.R
|
||||
% Please edit documentation in R/aa_amr-package.R
|
||||
\docType{package}
|
||||
\name{AMR}
|
||||
\alias{AMR}
|
||||
@ -28,37 +28,17 @@ A BibTeX entry for LaTeX users is:
|
||||
\description{
|
||||
Welcome to the \code{AMR} package.
|
||||
|
||||
\code{AMR} is a free, open-source and independent \R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
|
||||
The \code{AMR} package is a \href{https://msberends.github.io/AMR/#copyright}{free and open-source} R package with \href{https://en.wikipedia.org/wiki/Dependency_hell}{zero dependencies} to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. \strong{Our aim is to provide a standard} for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting. \href{https://msberends.github.io/AMR/authors.html}{Many different researchers} from around the globe are continually helping us to make this a successful and durable project!
|
||||
|
||||
This work was published in the Journal of Statistical Software (Volume 104(3); \doi{10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\doi{10.33612/diss.177417131} and \doi{10.33612/diss.192486375}).
|
||||
This work was published in the Journal of Statistical Software (Volume 104(3); \href{https://doi.org/10.18637/jss.v104.i03}{DOI 10.18637/jss.v104.i03}) and formed the basis of two PhD theses (\href{https://doi.org/10.33612/diss.177417131}{DOI 10.33612/diss.177417131} and \href{https://doi.org/10.33612/diss.192486375}{DOI 10.33612/diss.192486375}).
|
||||
|
||||
After installing this package, \R knows ~52,000 distinct microbial species and all ~600 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
|
||||
After installing this package, R knows \href{https://msberends.github.io/AMR/reference/microorganisms.html}{\strong{~52,000}} (updated December 2022) and all \href{https://msberends.github.io/AMR/reference/antibiotics.html}{\strong{~600 antibiotic, antimycotic and antiviral drugs}} by name and code (including ATC, EARS-Net, ASIARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid SIR and MIC values. The integral breakpoint guidelines from CLSI and EUCAST are included from the last 10 years. It supports and can read any data format, including WHONET data. This package works on Windows, macOS and Linux with all versions of R since R-3.0 (April 2013). \strong{It was designed to work in any setting, including those with very limited resources}. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the \href{https://www.rug.nl}{University of Groningen}, in collaboration with non-profit organisations \href{https://www.certe.nl}{Certe Medical Diagnostics and Advice Foundation} and \href{https://www.umcg.nl}{University Medical Center Groningen}.
|
||||
|
||||
This package is fully independent of any other \R package and works on Windows, macOS and Linux with all versions of \R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This \R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
|
||||
|
||||
This package can be used for:
|
||||
\itemize{
|
||||
\item Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the List of Prokaryotic names with Standing in Nomenclature (LPSN) and the Global Biodiversity Information Facility (GBIF)
|
||||
\item Interpreting raw MIC and disk diffusion values, based on any CLSI or EUCAST guideline from the last 10 years
|
||||
\item Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records
|
||||
\item Determining first isolates to be used for AMR data analysis
|
||||
\item Calculating antimicrobial resistance
|
||||
\item Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO)
|
||||
\item Calculating (empirical) susceptibility of both mono therapy and combination therapies
|
||||
\item Predicting future antimicrobial resistance using regression models
|
||||
\item Getting properties for any microorganism (such as Gram stain, species, genus or family)
|
||||
\item Getting properties for any antibiotic (such as name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
|
||||
\item Plotting antimicrobial resistance
|
||||
\item Applying EUCAST expert rules
|
||||
\item Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code
|
||||
\item Getting LOINC codes of an antibiotic, or getting properties of an antibiotic based on a LOINC code
|
||||
\item Machine reading the EUCAST and CLSI guidelines from 2011-2020 to translate MIC values and disk diffusion diameters to R/SI
|
||||
\item Principal component analysis for AMR
|
||||
}
|
||||
The \code{AMR} package is available in English, Chinese, Danish, Dutch, French, German, Greek, Italian, Japanese, Polish, Portuguese, Russian, Spanish, Swedish, Turkish and Ukrainian. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.
|
||||
}
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\seealso{
|
||||
|
@ -32,7 +32,7 @@ A \link[tibble:tibble]{tibble} with 500 observations and 53 variables:
|
||||
\item \verb{Inducible clindamycin resistance}\cr Clindamycin can be induced?
|
||||
\item \code{Comment}\cr Other comments
|
||||
\item \verb{Date of data entry}\cr \link{Date} this data was entered in WHONET
|
||||
\item \code{AMP_ND10:CIP_EE}\cr 28 different antibiotics. You can lookup the abbreviations in the \link{antibiotics} data set, or use e.g. \code{\link[=ab_name]{ab_name("AMP")}} to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using \code{\link[=as.rsi]{as.rsi()}}.
|
||||
\item \code{AMP_ND10:CIP_EE}\cr 0 different antibiotics. You can lookup the abbreviations in the \link{antibiotics} data set, or use e.g. \code{\link[=ab_name]{ab_name("AMP")}} to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using \code{\link[=as.sir]{as.sir()}}.
|
||||
}
|
||||
}
|
||||
\usage{
|
||||
|
@ -104,7 +104,7 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
@ -166,7 +166,7 @@ if (require("dplyr")) {
|
||||
head()
|
||||
|
||||
example_isolates \%>\%
|
||||
set_ab_names(where(is.rsi)) \%>\%
|
||||
set_ab_names(where(is.sir)) \%>\%
|
||||
colnames()
|
||||
|
||||
example_isolates \%>\%
|
||||
|
@ -93,8 +93,8 @@ ab_name("J01CR50")
|
||||
# even antibiotic selectors work
|
||||
x <- data.frame(
|
||||
random_column = "some value",
|
||||
coflu = as.rsi("S"),
|
||||
ampicillin = as.rsi("R")
|
||||
coflu = as.sir("S"),
|
||||
ampicillin = as.sir("R")
|
||||
)
|
||||
x
|
||||
x[, betalactams()]
|
||||
|
@ -22,7 +22,7 @@ This function will fill in missing taxonomy for you, if specific taxonomic colum
|
||||
|
||||
There are two ways to automate this process:
|
||||
|
||||
\strong{Method 1:} Using the , which is the preferred method. To use this method:
|
||||
\strong{Method 1:} Using the option \code{\link[=AMR-options]{AMR_custom_mo}}, which is the preferred method. To use this method:
|
||||
\enumerate{
|
||||
\item Create a data set in the structure of the \link{microorganisms} data set (containing at the very least column "genus") and save it with \code{\link[=saveRDS]{saveRDS()}} to a location of choice, e.g. \code{"~/my_custom_mo.rds"}, or any remote location.
|
||||
\item Set the file location to the \code{AMR_custom_mo} \R option: \code{options(AMR_custom_mo = "~/my_custom_mo.rds")}. This can even be a remote file location, such as an https URL. Since options are not saved between \R sessions, it is best to save this option to the \code{.Rprofile} file so that it will be loaded on start-up of \R. To do this, open the \code{.Rprofile} file using e.g. \code{utils::file.edit("~/.Rprofile")}, add this text and save the file:
|
||||
|
@ -62,7 +62,7 @@ if (require("dplyr") && require("ggplot2")) {
|
||||
filter(mo == as.mo("Escherichia coli")) \%>\%
|
||||
group_by(age_group = age_groups(age)) \%>\%
|
||||
select(age_group, CIP) \%>\%
|
||||
ggplot_rsi(
|
||||
ggplot_sir(
|
||||
x = "age_group",
|
||||
minimum = 0,
|
||||
x.title = "Age Group",
|
||||
|
@ -34,66 +34,66 @@
|
||||
\alias{not_intrinsic_resistant}
|
||||
\title{Antibiotic Selectors}
|
||||
\usage{
|
||||
ab_class(ab_class, only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
ab_class(ab_class, only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
ab_selector(filter, only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
ab_selector(filter, only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
aminoglycosides(only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
aminoglycosides(only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
aminopenicillins(only_rsi_columns = FALSE, ...)
|
||||
aminopenicillins(only_sir_columns = FALSE, ...)
|
||||
|
||||
antifungals(only_rsi_columns = FALSE, ...)
|
||||
antifungals(only_sir_columns = FALSE, ...)
|
||||
|
||||
antimycobacterials(only_rsi_columns = FALSE, ...)
|
||||
antimycobacterials(only_sir_columns = FALSE, ...)
|
||||
|
||||
betalactams(only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
betalactams(only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
carbapenems(only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
carbapenems(only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
cephalosporins(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins(only_sir_columns = FALSE, ...)
|
||||
|
||||
cephalosporins_1st(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins_1st(only_sir_columns = FALSE, ...)
|
||||
|
||||
cephalosporins_2nd(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins_2nd(only_sir_columns = FALSE, ...)
|
||||
|
||||
cephalosporins_3rd(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins_3rd(only_sir_columns = FALSE, ...)
|
||||
|
||||
cephalosporins_4th(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins_4th(only_sir_columns = FALSE, ...)
|
||||
|
||||
cephalosporins_5th(only_rsi_columns = FALSE, ...)
|
||||
cephalosporins_5th(only_sir_columns = FALSE, ...)
|
||||
|
||||
fluoroquinolones(only_rsi_columns = FALSE, ...)
|
||||
fluoroquinolones(only_sir_columns = FALSE, ...)
|
||||
|
||||
glycopeptides(only_rsi_columns = FALSE, ...)
|
||||
glycopeptides(only_sir_columns = FALSE, ...)
|
||||
|
||||
lincosamides(only_rsi_columns = FALSE, ...)
|
||||
lincosamides(only_sir_columns = FALSE, ...)
|
||||
|
||||
lipoglycopeptides(only_rsi_columns = FALSE, ...)
|
||||
lipoglycopeptides(only_sir_columns = FALSE, ...)
|
||||
|
||||
macrolides(only_rsi_columns = FALSE, ...)
|
||||
macrolides(only_sir_columns = FALSE, ...)
|
||||
|
||||
oxazolidinones(only_rsi_columns = FALSE, ...)
|
||||
oxazolidinones(only_sir_columns = FALSE, ...)
|
||||
|
||||
penicillins(only_rsi_columns = FALSE, ...)
|
||||
penicillins(only_sir_columns = FALSE, ...)
|
||||
|
||||
polymyxins(only_rsi_columns = FALSE, only_treatable = TRUE, ...)
|
||||
polymyxins(only_sir_columns = FALSE, only_treatable = TRUE, ...)
|
||||
|
||||
streptogramins(only_rsi_columns = FALSE, ...)
|
||||
streptogramins(only_sir_columns = FALSE, ...)
|
||||
|
||||
quinolones(only_rsi_columns = FALSE, ...)
|
||||
quinolones(only_sir_columns = FALSE, ...)
|
||||
|
||||
tetracyclines(only_rsi_columns = FALSE, ...)
|
||||
tetracyclines(only_sir_columns = FALSE, ...)
|
||||
|
||||
trimethoprims(only_rsi_columns = FALSE, ...)
|
||||
trimethoprims(only_sir_columns = FALSE, ...)
|
||||
|
||||
ureidopenicillins(only_rsi_columns = FALSE, ...)
|
||||
ureidopenicillins(only_sir_columns = FALSE, ...)
|
||||
|
||||
administrable_per_os(only_rsi_columns = FALSE, ...)
|
||||
administrable_per_os(only_sir_columns = FALSE, ...)
|
||||
|
||||
administrable_iv(only_rsi_columns = FALSE, ...)
|
||||
administrable_iv(only_sir_columns = FALSE, ...)
|
||||
|
||||
not_intrinsic_resistant(
|
||||
only_rsi_columns = FALSE,
|
||||
only_sir_columns = FALSE,
|
||||
col_mo = NULL,
|
||||
version_expertrules = 3.3,
|
||||
...
|
||||
@ -102,7 +102,7 @@ not_intrinsic_resistant(
|
||||
\arguments{
|
||||
\item{ab_class}{an antimicrobial class or a part of it, such as \code{"carba"} and \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns of class \code{rsi} must be selected (defaults to \code{FALSE}), see \code{\link[=as.rsi]{as.rsi()}}}
|
||||
\item{only_sir_columns}{a \link{logical} to indicate whether only columns of class \code{sir} must be selected (defaults to \code{FALSE}), see \code{\link[=as.sir]{as.sir()}}}
|
||||
|
||||
\item{only_treatable}{a \link{logical} to indicate whether antimicrobial drugs should be excluded that are only for laboratory tests (defaults to \code{TRUE}), such as gentamicin-high (\code{GEH}) and imipenem/EDTA (\code{IPE})}
|
||||
|
||||
@ -166,7 +166,7 @@ The \code{\link[=not_intrinsic_resistant]{not_intrinsic_resistant()}} function c
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -62,7 +62,7 @@ The WHOCC is located in Oslo at the Norwegian Institute of Public Health and fun
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
@ -92,9 +92,9 @@ ab_name("eryt")
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
|
||||
# you can quickly rename 'rsi' columns using set_ab_names() with dplyr:
|
||||
# you can quickly rename 'sir' columns using set_ab_names() with dplyr:
|
||||
example_isolates \%>\%
|
||||
set_ab_names(where(is.rsi), property = "atc")
|
||||
set_ab_names(where(is.sir), property = "atc")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ The WHOCC is located in Oslo at the Norwegian Institute of Public Health and fun
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -29,7 +29,7 @@ An \link{integer} with additional class \code{\link{disk}}
|
||||
This transforms a vector to a new class \code{\link{disk}}, which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50.
|
||||
}
|
||||
\details{
|
||||
Interpret disk values as RSI values with \code{\link[=as.rsi]{as.rsi()}}. It supports guidelines from EUCAST and CLSI.
|
||||
Interpret disk values as SIR values with \code{\link[=as.sir]{as.sir()}}. It supports guidelines from EUCAST and CLSI.
|
||||
|
||||
Disk diffusion growth zone sizes must be between 6 and 50 millimetres. Values higher than 50 but lower than 100 will be maximised to 50. All others input values outside the 6-50 range will return \code{NA}.
|
||||
|
||||
@ -54,8 +54,8 @@ if (require("dplyr")) {
|
||||
}
|
||||
}
|
||||
|
||||
# interpret disk values, see ?as.rsi
|
||||
as.rsi(
|
||||
# interpret disk values, see ?as.sir
|
||||
as.sir(
|
||||
x = as.disk(18),
|
||||
mo = "Strep pneu", # `mo` will be coerced with as.mo()
|
||||
ab = "ampicillin", # and `ab` with as.ab()
|
||||
@ -63,9 +63,9 @@ as.rsi(
|
||||
)
|
||||
|
||||
# interpret whole data set, pretend to be all from urinary tract infections:
|
||||
as.rsi(df, uti = TRUE)
|
||||
as.sir(df, uti = TRUE)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=as.rsi]{as.rsi()}}
|
||||
\code{\link[=as.sir]{as.sir()}}
|
||||
}
|
||||
\keyword{datasets}
|
||||
|
@ -33,7 +33,7 @@ Ordered \link{factor} with additional class \code{\link{mic}}, that in mathemati
|
||||
This transforms vectors to a new class \code{\link{mic}}, which treats the input as decimal numbers, while maintaining operators (such as ">=") and only allowing valid MIC values known to the field of (medical) microbiology.
|
||||
}
|
||||
\details{
|
||||
To interpret MIC values as RSI values, use \code{\link[=as.rsi]{as.rsi()}} on MIC values. It supports guidelines from EUCAST (2013-2022) and CLSI (2013-2022).
|
||||
To interpret MIC values as SIR values, use \code{\link[=as.sir]{as.sir()}} on MIC values. It supports guidelines from EUCAST (2013-2022) and CLSI (2013-2022).
|
||||
|
||||
This class for MIC values is a quite a special data type: formally it is an ordered \link{factor} with valid MIC values as \link{factor} levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
|
||||
|
||||
@ -82,7 +82,7 @@ mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
||||
mic_data
|
||||
is.mic(mic_data)
|
||||
|
||||
# this can also coerce combined MIC/RSI values:
|
||||
# this can also coerce combined MIC/SIR values:
|
||||
as.mic("<=0.002; S")
|
||||
|
||||
# mathematical processing treats MICs as numeric values
|
||||
@ -91,13 +91,13 @@ quantile(mic_data)
|
||||
all(mic_data < 512)
|
||||
|
||||
# interpret MIC values
|
||||
as.rsi(
|
||||
as.sir(
|
||||
x = as.mic(2),
|
||||
mo = as.mo("Streptococcus pneumoniae"),
|
||||
ab = "AMX",
|
||||
guideline = "EUCAST"
|
||||
)
|
||||
as.rsi(
|
||||
as.sir(
|
||||
x = as.mic(c(0.01, 2, 4, 8)),
|
||||
mo = as.mo("Streptococcus pneumoniae"),
|
||||
ab = "AMX",
|
||||
@ -119,6 +119,6 @@ if (require("ggplot2")) {
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=as.rsi]{as.rsi()}}
|
||||
\code{\link[=as.sir]{as.sir()}}
|
||||
}
|
||||
\keyword{datasets}
|
||||
|
@ -167,7 +167,7 @@ All matches are sorted descending on their matching score and for all user input
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
161
man/as.rsi.Rd → man/as.sir.Rd
Executable file → Normal file
161
man/as.rsi.Rd → man/as.sir.Rd
Executable file → Normal file
@ -1,19 +1,19 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/rsi.R
|
||||
% Please edit documentation in R/sir.R
|
||||
\docType{data}
|
||||
\name{as.rsi}
|
||||
\alias{as.rsi}
|
||||
\alias{rsi}
|
||||
\alias{NA_rsi_}
|
||||
\alias{is.rsi}
|
||||
\alias{is.rsi.eligible}
|
||||
\alias{as.rsi.mic}
|
||||
\alias{as.rsi.disk}
|
||||
\alias{as.rsi.data.frame}
|
||||
\alias{rsi_interpretation_history}
|
||||
\title{Interpret MIC and Disk Values, or Clean Raw R/SI Data}
|
||||
\name{as.sir}
|
||||
\alias{as.sir}
|
||||
\alias{sir}
|
||||
\alias{NA_sir_}
|
||||
\alias{is.sir}
|
||||
\alias{is_sir_eligible}
|
||||
\alias{as.sir.mic}
|
||||
\alias{as.sir.disk}
|
||||
\alias{as.sir.data.frame}
|
||||
\alias{sir_interpretation_history}
|
||||
\title{Translate MIC and Disk Diffusion to SIR, or Clean Existing SIR Data}
|
||||
\format{
|
||||
An object of class \code{rsi} (inherits from \code{ordered}, \code{factor}) of length 1.
|
||||
An object of class \code{sir} (inherits from \code{ordered}, \code{factor}) of length 1.
|
||||
}
|
||||
\source{
|
||||
For interpretations of minimum inhibitory concentration (MIC) values and disk diffusion diameters:
|
||||
@ -24,15 +24,15 @@ For interpretations of minimum inhibitory concentration (MIC) values and disk di
|
||||
}
|
||||
}
|
||||
\usage{
|
||||
as.rsi(x, ...)
|
||||
as.sir(x, ...)
|
||||
|
||||
NA_rsi_
|
||||
NA_sir_
|
||||
|
||||
is.rsi(x)
|
||||
is.sir(x)
|
||||
|
||||
is.rsi.eligible(x, threshold = 0.05)
|
||||
is_sir_eligible(x, threshold = 0.05)
|
||||
|
||||
\method{as.rsi}{mic}(
|
||||
\method{as.sir}{mic}(
|
||||
x,
|
||||
mo = NULL,
|
||||
ab = deparse(substitute(x)),
|
||||
@ -40,22 +40,22 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = AMR::rsi_translation,
|
||||
reference_data = AMR::clinical_breakpoints,
|
||||
...
|
||||
)
|
||||
|
||||
\method{as.rsi}{disk}(
|
||||
\method{as.sir}{disk}(
|
||||
x,
|
||||
mo = NULL,
|
||||
ab = deparse(substitute(x)),
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
uti = NULL,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = AMR::rsi_translation,
|
||||
reference_data = AMR::clinical_breakpoints,
|
||||
...
|
||||
)
|
||||
|
||||
\method{as.rsi}{data.frame}(
|
||||
\method{as.sir}{data.frame}(
|
||||
x,
|
||||
...,
|
||||
col_mo = NULL,
|
||||
@ -63,15 +63,15 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
uti = NULL,
|
||||
conserve_capped_values = FALSE,
|
||||
add_intrinsic_resistance = FALSE,
|
||||
reference_data = AMR::rsi_translation
|
||||
reference_data = AMR::clinical_breakpoints
|
||||
)
|
||||
|
||||
rsi_interpretation_history(clean = FALSE)
|
||||
sir_interpretation_history(clean = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{vector of values (for class \code{\link{mic}}: MIC values in mg/L, for class \code{\link{disk}}: a disk diffusion radius in millimetres)}
|
||||
|
||||
\item{...}{for using on a \link{data.frame}: names of columns to apply \code{\link[=as.rsi]{as.rsi()}} on (supports tidy selection such as \code{column1:column4}). Otherwise: arguments passed on to methods.}
|
||||
\item{...}{for using on a \link{data.frame}: names of columns to apply \code{\link[=as.sir]{as.sir()}} on (supports tidy selection such as \code{column1:column4}). Otherwise: arguments passed on to methods.}
|
||||
|
||||
\item{threshold}{maximum fraction of invalid antimicrobial interpretations of \code{x}, see \emph{Examples}}
|
||||
|
||||
@ -79,53 +79,53 @@ rsi_interpretation_history(clean = FALSE)
|
||||
|
||||
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial drug code with \code{\link[=as.ab]{as.ab()}}}
|
||||
|
||||
\item{guideline}{defaults to EUCAST 2022 (the latest implemented EUCAST guideline in the \link{rsi_translation} data set), but can be set with the \link[=options]{option} \code{AMR_guideline}. Supports EUCAST (2013-2022) and CLSI (2013-2022), see \emph{Details}.}
|
||||
\item{guideline}{defaults to EUCAST 2022 (the latest implemented EUCAST guideline in the \link{clinical_breakpoints} data set), but can be set with the \link[=options]{option} \code{AMR_guideline}. Supports EUCAST (2013-2022) and CLSI (2013-2022), see \emph{Details}.}
|
||||
|
||||
\item{uti}{(Urinary Tract Infection) A vector with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.rsi]{as.rsi()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||
\item{uti}{(Urinary Tract Infection) A vector with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.sir]{as.sir()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a column 'specimen', and rows within this column containing 'urin' (such as 'urine', 'urina') will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||
|
||||
\item{conserve_capped_values}{a \link{logical} to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
||||
|
||||
\item{add_intrinsic_resistance}{\emph{(only useful when using a EUCAST guideline)} a \link{logical} to indicate whether intrinsic antibiotic resistance must also be considered for applicable bug-drug combinations, meaning that e.g. ampicillin will always return "R" in \emph{Klebsiella} species. Determination is based on the \link{intrinsic_resistant} data set, that itself is based on \href{https://www.eucast.org/expert_rules_and_expected_phenotypes/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.3} (2021).}
|
||||
|
||||
\item{reference_data}{a \link{data.frame} to be used for interpretation, which defaults to the \link{rsi_translation} data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the \link{rsi_translation} data set (same column names and column types). Please note that the \code{guideline} argument will be ignored when \code{reference_data} is manually set.}
|
||||
\item{reference_data}{a \link{data.frame} to be used for interpretation, which defaults to the \link{clinical_breakpoints} data set. Changing this argument allows for using own interpretation guidelines. This argument must contain a data set that is equal in structure to the \link{clinical_breakpoints} data set (same column names and column types). Please note that the \code{guideline} argument will be ignored when \code{reference_data} is manually set.}
|
||||
|
||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||
|
||||
\item{clean}{a \link{logical} to indicate whether previously stored results should be forgotten after returning the 'logbook' with results}
|
||||
}
|
||||
\value{
|
||||
Ordered \link{factor} with new class \code{rsi}
|
||||
Ordered \link{factor} with new class \code{sir}
|
||||
}
|
||||
\description{
|
||||
Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class \code{\link{rsi}}, which is an ordered \link{factor} with levels \verb{S < I < R}.
|
||||
Interpret minimum inhibitory concentration (MIC) values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing SIR values. This transforms the input to a new class \code{\link{sir}}, which is an ordered \link{factor} with levels \verb{S < I < R}.
|
||||
}
|
||||
\details{
|
||||
\subsection{How it Works}{
|
||||
|
||||
The \code{\link[=as.rsi]{as.rsi()}} function works in four ways:
|
||||
The \code{\link[=as.sir]{as.sir()}} function works in four ways:
|
||||
\enumerate{
|
||||
\item For \strong{cleaning raw / untransformed data}. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with R/SI interpretations and MIC values such as \code{"<0.25; S"} will be coerced to \code{"S"}. Combined interpretations for multiple test methods (as seen in laboratory records) such as \code{"S; S"} will be coerced to \code{"S"}, but a value like \code{"S; I"} will return \code{NA} with a warning that the input is unclear.
|
||||
\item For \strong{cleaning raw / untransformed data}. The data will be cleaned to only contain values S, I and R and will try its best to determine this with some intelligence. For example, mixed values with SIR interpretations and MIC values such as \code{"<0.25; S"} will be coerced to \code{"S"}. Combined interpretations for multiple test methods (as seen in laboratory records) such as \code{"S; S"} will be coerced to \code{"S"}, but a value like \code{"S; I"} will return \code{NA} with a warning that the input is unclear.
|
||||
\item For \strong{interpreting minimum inhibitory concentration (MIC) values} according to EUCAST or CLSI. You must clean your MIC values first using \code{\link[=as.mic]{as.mic()}}, that also gives your columns the new data class \code{\link{mic}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||
\itemize{
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:
|
||||
\item Using \code{dplyr}, SIR interpretation can be done very easily with either:
|
||||
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{your_data \%>\% mutate_if(is.mic, as.rsi)
|
||||
your_data \%>\% mutate(across(where(is.mic), as.rsi))
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{your_data \%>\% mutate_if(is.mic, as.sir)
|
||||
your_data \%>\% mutate(across(where(is.mic), as.sir))
|
||||
}\if{html}{\out{</div>}}
|
||||
\item Operators like "<=" will be stripped before interpretation. When using \code{conserve_capped_values = TRUE}, an MIC value of e.g. ">2" will always return "R", even if the breakpoint according to the chosen guideline is ">=4". This is to prevent that capped values from raw laboratory data would not be treated conservatively. The default behaviour (\code{conserve_capped_values = FALSE}) considers ">2" to be lower than ">=4" and might in this case return "S" or "I".
|
||||
}
|
||||
\item For \strong{interpreting disk diffusion diameters} according to EUCAST or CLSI. You must clean your disk zones first using \code{\link[=as.disk]{as.disk()}}, that also gives your columns the new data class \code{\link{disk}}. Also, be sure to have a column with microorganism names or codes. It will be found automatically, but can be set manually using the \code{mo} argument.
|
||||
\itemize{
|
||||
\item Using \code{dplyr}, R/SI interpretation can be done very easily with either:
|
||||
\item Using \code{dplyr}, SIR interpretation can be done very easily with either:
|
||||
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{your_data \%>\% mutate_if(is.disk, as.rsi)
|
||||
your_data \%>\% mutate(across(where(is.disk), as.rsi))
|
||||
\if{html}{\out{<div class="sourceCode">}}\preformatted{your_data \%>\% mutate_if(is.disk, as.sir)
|
||||
your_data \%>\% mutate(across(where(is.disk), as.sir))
|
||||
}\if{html}{\out{</div>}}
|
||||
}
|
||||
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.rsi(your_data)}.
|
||||
\item For \strong{interpreting a complete data set}, with automatic determination of MIC values, disk diffusion diameters, microorganism names or codes, and antimicrobial test results. This is done very simply by running \code{as.sir(your_data)}.
|
||||
}
|
||||
|
||||
For points 2, 3 and 4: Use \code{\link[=rsi_interpretation_history]{rsi_interpretation_history()}} to retrieve a \link{data.frame} (or \link[tibble:tibble]{tibble} if the \code{tibble} package is installed) with all results of the last \code{\link[=as.rsi]{as.rsi()}} call.
|
||||
For points 2, 3 and 4: Use \code{\link[=sir_interpretation_history]{sir_interpretation_history()}} to retrieve a \link{data.frame} (or \link[tibble:tibble]{tibble} if the \code{tibble} package is installed) with all results of the last \code{\link[=as.sir]{as.sir()}} call.
|
||||
}
|
||||
|
||||
\subsection{Supported Guidelines}{
|
||||
@ -146,33 +146,36 @@ You can set the default guideline with the \code{AMR_guideline} \link[=options]{
|
||||
|
||||
\subsection{After Interpretation}{
|
||||
|
||||
After using \code{\link[=as.rsi]{as.rsi()}}, you can use the \code{\link[=eucast_rules]{eucast_rules()}} defined by EUCAST 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.
|
||||
After using \code{\link[=as.sir]{as.sir()}}, you can use the \code{\link[=eucast_rules]{eucast_rules()}} defined by EUCAST 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.
|
||||
}
|
||||
|
||||
\subsection{Machine-Readable Interpretation Guidelines}{
|
||||
|
||||
The repository of this package \href{https://github.com/msberends/AMR/blob/main/data-raw/rsi_translation.txt}{contains a machine-readable version} of all guidelines. This is a CSV file consisting of 18,308 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
||||
The repository of this package \href{https://github.com/msberends/AMR/blob/main/data-raw/clinical_breakpoints.txt}{contains a machine-readable version} of all guidelines. This is a CSV file consisting of 18,308 rows and 11 columns. This file is machine-readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial drug and the microorganism. \strong{This allows for easy implementation of these rules in laboratory information systems (LIS)}. Note that it only contains interpretation guidelines for humans - interpretation guidelines from CLSI for animals were removed.
|
||||
}
|
||||
|
||||
\subsection{Other}{
|
||||
|
||||
The function \code{\link[=is.rsi]{is.rsi()}} detects if the input contains class \code{rsi}. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
The function \code{\link[=is.sir]{is.sir()}} detects if the input contains class \code{sir}. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
|
||||
The function \code{\link[=is.rsi.eligible]{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} argument. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
The function \code{\link[=is_sir_eligible]{is_sir_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} argument. If the input is a \link{data.frame}, it iterates over all columns and returns a \link{logical} vector.
|
||||
}
|
||||
|
||||
\code{NA_rsi_} is a missing value of the new \code{rsi} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
\code{NA_sir_} is a missing value of the new \code{sir} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
|
||||
}
|
||||
\section{Interpretation of R and S/I}{
|
||||
\section{Interpretation of SIR}{
|
||||
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (\url{https://www.eucast.org/newsiandr/}).
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (\url{https://www.eucast.org/newsiandr/}):
|
||||
\itemize{
|
||||
\item \strong{S - Susceptible, standard dosing regimen}\cr
|
||||
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} \emph{\cr
|
||||
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}\cr
|
||||
A microorganism is categorised as \emph{Resistant} when there is a high likelihood of therapeutic failure even when there is increased exposure. 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.
|
||||
\item \strong{S = Susceptible}\cr
|
||||
A microorganism is categorised as \emph{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}\cr
|
||||
A microorganism is categorised as \emph{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.
|
||||
A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.
|
||||
\itemize{
|
||||
\item \emph{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 insight. Use \code{\link[=susceptibility]{susceptibility()}} (equal to \code{\link[=proportion_SI]{proportion_SI()}}) to determine antimicrobial susceptibility and \code{\link[=count_susceptible]{count_susceptible()}} (equal to \code{\link[=count_SI]{count_SI()}}) to count susceptible isolates.
|
||||
@ -180,12 +183,12 @@ This AMR package honours this insight. Use \code{\link[=susceptibility]{suscepti
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
example_isolates
|
||||
summary(example_isolates) # see all R/SI results at a glance
|
||||
summary(example_isolates) # see all SIR results at a glance
|
||||
|
||||
# For INTERPRETING disk diffusion and MIC values -----------------------
|
||||
|
||||
@ -198,20 +201,20 @@ df <- data.frame(
|
||||
TOB = as.disk(16),
|
||||
ERY = "R"
|
||||
)
|
||||
as.rsi(df)
|
||||
as.sir(df)
|
||||
|
||||
# return a 'logbook' about the results:
|
||||
rsi_interpretation_history()
|
||||
sir_interpretation_history()
|
||||
|
||||
# for single values
|
||||
as.rsi(
|
||||
as.sir(
|
||||
x = as.mic(2),
|
||||
mo = as.mo("S. pneumoniae"),
|
||||
ab = "AMP",
|
||||
guideline = "EUCAST"
|
||||
)
|
||||
|
||||
as.rsi(
|
||||
as.sir(
|
||||
x = as.disk(18),
|
||||
mo = "Strep pneu", # `mo` will be coerced with as.mo()
|
||||
ab = "ampicillin", # and `ab` with as.ab()
|
||||
@ -221,14 +224,14 @@ as.rsi(
|
||||
\donttest{
|
||||
# the dplyr way
|
||||
if (require("dplyr")) {
|
||||
df \%>\% mutate_if(is.mic, as.rsi)
|
||||
df \%>\% mutate_if(function(x) is.mic(x) | is.disk(x), as.rsi)
|
||||
df \%>\% mutate(across(where(is.mic), as.rsi))
|
||||
df \%>\% mutate_at(vars(AMP:TOB), as.rsi)
|
||||
df \%>\% mutate(across(AMP:TOB, as.rsi))
|
||||
df \%>\% mutate_if(is.mic, as.sir)
|
||||
df \%>\% mutate_if(function(x) is.mic(x) | is.disk(x), as.sir)
|
||||
df \%>\% mutate(across(where(is.mic), as.sir))
|
||||
df \%>\% mutate_at(vars(AMP:TOB), as.sir)
|
||||
df \%>\% mutate(across(AMP:TOB, as.sir))
|
||||
|
||||
df \%>\%
|
||||
mutate_at(vars(AMP:TOB), as.rsi, mo = .$microorganism)
|
||||
mutate_at(vars(AMP:TOB), as.sir, mo = .$microorganism)
|
||||
|
||||
# to include information about urinary tract infections (UTI)
|
||||
data.frame(
|
||||
@ -236,43 +239,43 @@ if (require("dplyr")) {
|
||||
NIT = c("<= 2", 32),
|
||||
from_the_bladder = c(TRUE, FALSE)
|
||||
) \%>\%
|
||||
as.rsi(uti = "from_the_bladder")
|
||||
as.sir(uti = "from_the_bladder")
|
||||
|
||||
data.frame(
|
||||
mo = "E. coli",
|
||||
NIT = c("<= 2", 32),
|
||||
specimen = c("urine", "blood")
|
||||
) \%>\%
|
||||
as.rsi() # automatically determines urine isolates
|
||||
as.sir() # automatically determines urine isolates
|
||||
|
||||
df \%>\%
|
||||
mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli", uti = TRUE)
|
||||
mutate_at(vars(AMP:TOB), as.sir, mo = "E. coli", uti = TRUE)
|
||||
}
|
||||
|
||||
# For CLEANING existing R/SI values ------------------------------------
|
||||
# For CLEANING existing SIR values ------------------------------------
|
||||
|
||||
as.rsi(c("S", "I", "R", "A", "B", "C"))
|
||||
as.rsi("<= 0.002; S") # will return "S"
|
||||
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||
is.rsi(rsi_data)
|
||||
plot(rsi_data) # for percentages
|
||||
barplot(rsi_data) # for frequencies
|
||||
as.sir(c("S", "I", "R", "A", "B", "C"))
|
||||
as.sir("<= 0.002; S") # will return "S"
|
||||
sir_data <- as.sir(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||
is.sir(sir_data)
|
||||
plot(sir_data) # for percentages
|
||||
barplot(sir_data) # for frequencies
|
||||
|
||||
# the dplyr way
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
mutate_at(vars(PEN:RIF), as.rsi)
|
||||
mutate_at(vars(PEN:RIF), as.sir)
|
||||
# same:
|
||||
example_isolates \%>\%
|
||||
as.rsi(PEN:RIF)
|
||||
as.sir(PEN:RIF)
|
||||
|
||||
# fastest way to transform all columns with already valid AMR results to class `rsi`:
|
||||
# fastest way to transform all columns with already valid AMR results to class `sir`:
|
||||
example_isolates \%>\%
|
||||
mutate_if(is.rsi.eligible, as.rsi)
|
||||
mutate_if(is_sir_eligible, as.sir)
|
||||
|
||||
# since dplyr 1.0.0, this can also be:
|
||||
# example_isolates \%>\%
|
||||
# mutate(across(where(is.rsi.eligible), as.rsi))
|
||||
# mutate(across(where(is_sir_eligible), as.sir))
|
||||
}
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{htt
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -26,7 +26,7 @@ availability(example_isolates)
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
filter(mo == as.mo("Escherichia coli")) \%>\%
|
||||
select_if(is.rsi) \%>\%
|
||||
select_if(is.sir) \%>\%
|
||||
availability()
|
||||
}
|
||||
}
|
||||
|
12
man/rsi_translation.Rd → man/clinical_breakpoints.Rd
Executable file → Normal file
12
man/rsi_translation.Rd → man/clinical_breakpoints.Rd
Executable file → Normal file
@ -1,9 +1,9 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/data.R
|
||||
\docType{data}
|
||||
\name{rsi_translation}
|
||||
\alias{rsi_translation}
|
||||
\title{Data Set for R/SI Interpretation}
|
||||
\name{clinical_breakpoints}
|
||||
\alias{clinical_breakpoints}
|
||||
\title{Data Set with Clinical Breakpoints for SIR Interpretation}
|
||||
\format{
|
||||
A \link[tibble:tibble]{tibble} with 18,308 observations and 11 variables:
|
||||
\itemize{
|
||||
@ -21,10 +21,10 @@ A \link[tibble:tibble]{tibble} with 18,308 observations and 11 variables:
|
||||
}
|
||||
}
|
||||
\usage{
|
||||
rsi_translation
|
||||
clinical_breakpoints
|
||||
}
|
||||
\description{
|
||||
Data set containing reference data to interpret MIC and disk diffusion to R/SI values, according to international guidelines. Currently implemented guidelines are EUCAST (2013-2022) and CLSI (2013-2022). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to R/SI values.
|
||||
Data set containing clinical breakpoints to interpret MIC and disk diffusion to SIR values, according to international guidelines. Currently implemented guidelines are EUCAST (2013-2022) and CLSI (2013-2022). Use \code{\link[=as.sir]{as.sir()}} to transform MICs or disks measurements to SIR values.
|
||||
}
|
||||
\details{
|
||||
Like all data sets in this package, this data set is publicly available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
@ -32,7 +32,7 @@ Like all data sets in this package, this data set is publicly available for down
|
||||
They \strong{allow for machine reading EUCAST and CLSI guidelines}, which is almost impossible with the MS Excel and PDF files distributed by EUCAST and CLSI.
|
||||
}
|
||||
\examples{
|
||||
rsi_translation
|
||||
clinical_breakpoints
|
||||
}
|
||||
\seealso{
|
||||
\link{intrinsic_resistant}
|
39
man/count.Rd
39
man/count.Rd
@ -10,7 +10,7 @@
|
||||
\alias{count_SI}
|
||||
\alias{count_S}
|
||||
\alias{count_all}
|
||||
\alias{n_rsi}
|
||||
\alias{n_sir}
|
||||
\alias{count_df}
|
||||
\title{Count Available Isolates}
|
||||
\usage{
|
||||
@ -30,7 +30,7 @@ count_S(..., only_all_tested = FALSE)
|
||||
|
||||
count_all(..., only_all_tested = FALSE)
|
||||
|
||||
n_rsi(..., only_all_tested = FALSE)
|
||||
n_sir(..., only_all_tested = FALSE)
|
||||
|
||||
count_df(
|
||||
data,
|
||||
@ -40,11 +40,11 @@ count_df(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{...}{one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.rsi]{as.rsi()}} if needed.}
|
||||
\item{...}{one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed.}
|
||||
|
||||
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antibiotics, see section \emph{Combination Therapy} below}
|
||||
|
||||
\item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
|
||||
\item{data}{a \link{data.frame} containing columns with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}})}
|
||||
|
||||
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
|
||||
|
||||
@ -65,20 +65,23 @@ These functions are meant to count isolates. Use the \code{\link[=resistance]{re
|
||||
|
||||
The function \code{\link[=count_resistant]{count_resistant()}} is equal to the function \code{\link[=count_R]{count_R()}}. The function \code{\link[=count_susceptible]{count_susceptible()}} is equal to the function \code{\link[=count_SI]{count_SI()}}.
|
||||
|
||||
The function \code{\link[=n_rsi]{n_rsi()}} is an alias of \code{\link[=count_all]{count_all()}}. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to \code{n_distinct()}. Their function is equal to \code{count_susceptible(...) + count_resistant(...)}.
|
||||
The function \code{\link[=n_sir]{n_sir()}} is an alias of \code{\link[=count_all]{count_all()}}. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to \code{n_distinct()}. Their function is equal to \code{count_susceptible(...) + count_resistant(...)}.
|
||||
|
||||
The function \code{\link[=count_df]{count_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and counts the number of S's, I's and R's. It also supports grouped variables. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=count_df]{count_df()}}, but adds the percentage of S, I and R.
|
||||
The function \code{\link[=count_df]{count_df()}} takes any variable from \code{data} that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) and counts the number of S's, I's and R's. It also supports grouped variables. The function \code{\link[=sir_df]{sir_df()}} works exactly like \code{\link[=count_df]{count_df()}}, but adds the percentage of S, I and R.
|
||||
}
|
||||
\section{Interpretation of R and S/I}{
|
||||
\section{Interpretation of SIR}{
|
||||
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (\url{https://www.eucast.org/newsiandr/}).
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (\url{https://www.eucast.org/newsiandr/}):
|
||||
\itemize{
|
||||
\item \strong{S - Susceptible, standard dosing regimen}\cr
|
||||
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} \emph{\cr
|
||||
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}\cr
|
||||
A microorganism is categorised as \emph{Resistant} when there is a high likelihood of therapeutic failure even when there is increased exposure. 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.
|
||||
\item \strong{S = Susceptible}\cr
|
||||
A microorganism is categorised as \emph{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}\cr
|
||||
A microorganism is categorised as \emph{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.
|
||||
A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.
|
||||
\itemize{
|
||||
\item \emph{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 insight. Use \code{\link[=susceptibility]{susceptibility()}} (equal to \code{\link[=proportion_SI]{proportion_SI()}}) to determine antimicrobial susceptibility and \code{\link[=count_susceptible]{count_susceptible()}} (equal to \code{\link[=count_SI]{count_SI()}}) to count susceptible isolates.
|
||||
@ -139,14 +142,14 @@ count_R(example_isolates$AMX)
|
||||
|
||||
# Count all available isolates
|
||||
count_all(example_isolates$AMX)
|
||||
n_rsi(example_isolates$AMX)
|
||||
n_sir(example_isolates$AMX)
|
||||
|
||||
# n_rsi() is an alias of count_all().
|
||||
# n_sir() is an alias of count_all().
|
||||
# Since it counts all available isolates, you can
|
||||
# calculate back to count e.g. susceptible isolates.
|
||||
# These results are the same:
|
||||
count_susceptible(example_isolates$AMX)
|
||||
susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
|
||||
susceptibility(example_isolates$AMX) * n_sir(example_isolates$AMX)
|
||||
|
||||
# dplyr -------------------------------------------------------------
|
||||
\donttest{
|
||||
@ -158,7 +161,7 @@ if (require("dplyr")) {
|
||||
I = count_I(CIP),
|
||||
S = count_S(CIP),
|
||||
n1 = count_all(CIP), # the actual total; sum of all three
|
||||
n2 = n_rsi(CIP), # same - analogous to n_distinct
|
||||
n2 = n_sir(CIP), # same - analogous to n_distinct
|
||||
total = n()
|
||||
) # NOT the number of tested isolates!
|
||||
|
||||
@ -166,7 +169,7 @@ if (require("dplyr")) {
|
||||
# (i.e., in this data set columns GEN, TOB, AMK, KAN)
|
||||
example_isolates \%>\%
|
||||
group_by(ward) \%>\%
|
||||
summarise(across(aminoglycosides(), n_rsi))
|
||||
summarise(across(aminoglycosides(), n_sir))
|
||||
|
||||
# Count co-resistance between amoxicillin/clav acid and gentamicin,
|
||||
# so we can see that combination therapy does a lot more than mono therapy.
|
||||
|
@ -43,9 +43,9 @@ These are two custom EUCAST rules: if TZP (piperacillin/tazobactam) is "S", all
|
||||
The rules (the part \emph{before} the tilde, in above example \code{TZP == "S"} and \code{TZP == "R"}) must be evaluable in your data set: it should be able to run as a filter in your data set without errors. This means for the above example that the column \code{TZP} must exist. We will create a sample data set and test the rules set:
|
||||
|
||||
\if{html}{\out{<div class="sourceCode r">}}\preformatted{df <- data.frame(mo = c("Escherichia coli", "Klebsiella pneumoniae"),
|
||||
TZP = as.rsi("R"),
|
||||
ampi = as.rsi("S"),
|
||||
cipro = as.rsi("S"))
|
||||
TZP = as.sir("R"),
|
||||
ampi = as.sir("S"),
|
||||
cipro = as.sir("S"))
|
||||
df
|
||||
#> mo TZP ampi cipro
|
||||
#> 1 Escherichia coli R S S
|
||||
|
@ -28,7 +28,7 @@ eucast_rules(
|
||||
version_breakpoints = 12,
|
||||
version_expertrules = 3.3,
|
||||
ampc_cephalosporin_resistance = NA,
|
||||
only_rsi_columns = FALSE,
|
||||
only_sir_columns = FALSE,
|
||||
custom_rules = NULL,
|
||||
...
|
||||
)
|
||||
@ -52,7 +52,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 12)
|
||||
|
||||
\item{ampc_cephalosporin_resistance}{a \link{character} value that should be applied to cefotaxime, ceftriaxone and ceftazidime for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2} and higher; these version of '\emph{EUCAST Expert Rules on Enterobacterales}' state that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these three drugs. A value of \code{NA} (the default) for this argument will remove results for these three drugs, while e.g. a value of \code{"R"} will make the results for these drugs resistant. Use \code{NULL} or \code{FALSE} to not alter results for these three drugs of AmpC de-repressed cephalosporin-resistant mutants. Using \code{TRUE} is equal to using \code{"R"}. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia} and \emph{Serratia}.}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_sir_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (defaults to \code{FALSE})}
|
||||
|
||||
\item{custom_rules}{custom rules to apply, created with \code{\link[=custom_eucast_rules]{custom_eucast_rules()}}}
|
||||
|
||||
@ -71,7 +71,7 @@ Apply rules for clinical breakpoints and intrinsic resistance as defined by the
|
||||
To improve the interpretation of the antibiogram before EUCAST rules are applied, some non-EUCAST rules can applied at default, see \emph{Details}.
|
||||
}
|
||||
\details{
|
||||
\strong{Note:} This function does not translate MIC values to RSI values. Use \code{\link[=as.rsi]{as.rsi()}} for that. \cr
|
||||
\strong{Note:} This function does not translate MIC values to SIR values. Use \code{\link[=as.sir]{as.sir()}} for that. \cr
|
||||
\strong{Note:} When ampicillin (AMP, J01CA01) is not available but amoxicillin (AMX, J01CA04) is, the latter will be used for all rules where there is a dependency on ampicillin. These drugs are interchangeable when it comes to expression of antimicrobial resistance. \cr
|
||||
|
||||
The file containing all EUCAST rules is located here: \url{https://github.com/msberends/AMR/blob/main/data-raw/eucast_rules.tsv}. \strong{Note:} Old taxonomic names are replaced with the current taxonomy where applicable. For example, \emph{Ochrobactrum anthropi} was renamed to \emph{Brucella anthropi} in 2020; the original EUCAST rules v3.1 and v3.2 did not yet contain this new taxonomic name. The \code{AMR} package contains the full microbial taxonomy updated until 11 December, 2022, see \link{microorganisms}.
|
||||
@ -110,7 +110,7 @@ Amikacin (\code{AMK}, \href{https://www.whocc.no/atc_ddd_index/?code=J01GB06&sho
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -13,7 +13,7 @@ A \link[tibble:tibble]{tibble} with 2,000 observations and 46 variables:
|
||||
\item \code{gender}\cr Gender of the patient, either "F" or "M"
|
||||
\item \code{ward}\cr Ward type where the patient was admitted, either "Clinical", "ICU" or "Outpatient"
|
||||
\item \code{mo}\cr ID of microorganism created with \code{\link[=as.mo]{as.mo()}}, see also the \link{microorganisms} data set
|
||||
\item \code{PEN:RIF}\cr 40 different antibiotics with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}}); these column names occur in the \link{antibiotics} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
|
||||
\item \code{PEN:RIF}\cr 40 different antibiotics with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}); these column names occur in the \link{antibiotics} data set and can be translated with \code{\link[=set_ab_names]{set_ab_names()}} or \code{\link[=ab_name]{ab_name()}}
|
||||
}
|
||||
}
|
||||
\usage{
|
||||
|
@ -11,7 +11,7 @@ A \link[tibble:tibble]{tibble} with 3,000 observations and 8 variables:
|
||||
\item \code{date}\cr date of receipt at the laboratory
|
||||
\item \code{hospital}\cr ID of the hospital, from A to C
|
||||
\item \code{bacteria}\cr info about microorganism that can be transformed with \code{\link[=as.mo]{as.mo()}}, see also \link{microorganisms}
|
||||
\item \code{AMX:GEN}\cr 4 different antibiotics that have to be transformed with \code{\link[=as.rsi]{as.rsi()}}
|
||||
\item \code{AMX:GEN}\cr 4 different antibiotics that have to be transformed with \code{\link[=as.sir]{as.sir()}}
|
||||
}
|
||||
}
|
||||
\usage{
|
||||
|
@ -31,7 +31,7 @@ first_isolate(
|
||||
points_threshold = 2,
|
||||
info = interactive(),
|
||||
include_unknown = FALSE,
|
||||
include_untested_rsi = TRUE,
|
||||
include_untested_sir = TRUE,
|
||||
...
|
||||
)
|
||||
|
||||
@ -82,7 +82,7 @@ filter_first_isolate(
|
||||
|
||||
\item{include_unknown}{a \link{logical} to indicate whether 'unknown' microorganisms should be included too, i.e. microbial code \code{"UNKNOWN"}, which defaults to \code{FALSE}. For WHONET users, this means that all records with organism code \code{"con"} (\emph{contamination}) will be excluded at default. Isolates with a microbial ID of \code{NA} will always be excluded as first isolate.}
|
||||
|
||||
\item{include_untested_rsi}{a \link{logical} to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use \code{include_untested_rsi = FALSE} to always return \code{FALSE} for such rows. This checks the data set for columns of class \code{rsi} and consequently requires transforming columns with antibiotic results using \code{\link[=as.rsi]{as.rsi()}} first.}
|
||||
\item{include_untested_sir}{a \link{logical} to indicate whether also rows without antibiotic results are still eligible for becoming a first isolate. Use \code{include_untested_sir = FALSE} to always return \code{FALSE} for such rows. This checks the data set for columns of class \code{sir} and consequently requires transforming columns with antibiotic results using \code{\link[=as.sir]{as.sir()}} first.}
|
||||
|
||||
\item{...}{arguments passed on to \code{\link[=first_isolate]{first_isolate()}} when using \code{\link[=filter_first_isolate]{filter_first_isolate()}}, otherwise arguments passed on to \code{\link[=key_antimicrobials]{key_antimicrobials()}} (such as \code{universal}, \code{gram_negative}, \code{gram_positive})}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ if (require("dplyr")) {
|
||||
genus = mo_genus(mo)
|
||||
) \%>\% # and genus as we do here;
|
||||
filter(n() >= 30) \%>\% # filter on only 30 results per group
|
||||
summarise_if(is.rsi, resistance) # then get resistance of all drugs
|
||||
summarise_if(is.sir, resistance) # then get resistance of all drugs
|
||||
|
||||
# now conduct PCA for certain antimicrobial drugs
|
||||
pca_result <- resistance_data \%>\%
|
||||
|
72
man/ggplot_rsi.Rd → man/ggplot_sir.Rd
Executable file → Normal file
72
man/ggplot_rsi.Rd → man/ggplot_sir.Rd
Executable file → Normal file
@ -1,16 +1,16 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/ggplot_rsi.R
|
||||
\name{ggplot_rsi}
|
||||
\alias{ggplot_rsi}
|
||||
\alias{geom_rsi}
|
||||
\alias{facet_rsi}
|
||||
% Please edit documentation in R/ggplot_sir.R
|
||||
\name{ggplot_sir}
|
||||
\alias{ggplot_sir}
|
||||
\alias{geom_sir}
|
||||
\alias{facet_sir}
|
||||
\alias{scale_y_percent}
|
||||
\alias{scale_rsi_colours}
|
||||
\alias{theme_rsi}
|
||||
\alias{labels_rsi_count}
|
||||
\alias{scale_sir_colours}
|
||||
\alias{theme_sir}
|
||||
\alias{labels_sir_count}
|
||||
\title{AMR Plots with \code{ggplot2}}
|
||||
\usage{
|
||||
ggplot_rsi(
|
||||
ggplot_sir(
|
||||
data,
|
||||
position = NULL,
|
||||
x = "antibiotic",
|
||||
@ -36,7 +36,7 @@ ggplot_rsi(
|
||||
...
|
||||
)
|
||||
|
||||
geom_rsi(
|
||||
geom_sir(
|
||||
position = NULL,
|
||||
x = c("antibiotic", "interpretation"),
|
||||
fill = "interpretation",
|
||||
@ -47,15 +47,15 @@ geom_rsi(
|
||||
...
|
||||
)
|
||||
|
||||
facet_rsi(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
||||
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
|
||||
|
||||
scale_y_percent(breaks = seq(0, 1, 0.1), limits = NULL)
|
||||
|
||||
scale_rsi_colours(..., aesthetics = "fill")
|
||||
scale_sir_colours(..., aesthetics = "fill")
|
||||
|
||||
theme_rsi()
|
||||
theme_sir()
|
||||
|
||||
labels_rsi_count(
|
||||
labels_sir_count(
|
||||
position = NULL,
|
||||
x = "antibiotic",
|
||||
translate_ab = "name",
|
||||
@ -67,7 +67,7 @@ labels_rsi_count(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{a \link{data.frame} with column(s) of class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
|
||||
\item{data}{a \link{data.frame} with column(s) of class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}})}
|
||||
|
||||
\item{position}{position adjustment of bars, either \code{"fill"}, \code{"stack"} or \code{"dodge"}}
|
||||
|
||||
@ -93,7 +93,7 @@ labels_rsi_count(
|
||||
|
||||
\item{colours}{a named vactor with colour to be used for filling. The default colours are colour-blind friendly.}
|
||||
|
||||
\item{datalabels}{show datalabels using \code{\link[=labels_rsi_count]{labels_rsi_count()}}}
|
||||
\item{datalabels}{show datalabels using \code{\link[=labels_sir_count]{labels_sir_count()}}}
|
||||
|
||||
\item{datalabels.size}{size of the datalabels}
|
||||
|
||||
@ -109,7 +109,7 @@ labels_rsi_count(
|
||||
|
||||
\item{y.title}{text to show as y axis description}
|
||||
|
||||
\item{...}{other arguments passed on to \code{\link[=geom_rsi]{geom_rsi()}} or, in case of \code{\link[=scale_rsi_colours]{scale_rsi_colours()}}, named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See \emph{Examples}.}
|
||||
\item{...}{other arguments passed on to \code{\link[=geom_sir]{geom_sir()}} or, in case of \code{\link[=scale_sir_colours]{scale_sir_colours()}}, named values to set colours. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red. See \emph{Examples}.}
|
||||
|
||||
\item{aesthetics}{aesthetics to apply the colours to, defaults to "fill" but can also be (a combination of) "alpha", "colour", "fill", "linetype", "shape" or "size"}
|
||||
}
|
||||
@ -120,19 +120,19 @@ Use these functions to create bar plots for AMR data analysis. All functions rel
|
||||
At default, the names of antibiotics will be shown on the plots using \code{\link[=ab_name]{ab_name()}}. This can be set with the \code{translate_ab} argument. See \code{\link[=count_df]{count_df()}}.
|
||||
\subsection{The Functions}{
|
||||
|
||||
\code{\link[=geom_rsi]{geom_rsi()}} will take any variable from the data that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) using \code{\link[=rsi_df]{rsi_df()}} and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
||||
\code{\link[=geom_sir]{geom_sir()}} will take any variable from the data that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) using \code{\link[=sir_df]{sir_df()}} and will plot bars with the percentage S, I, and R. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.
|
||||
|
||||
\code{\link[=facet_rsi]{facet_rsi()}} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}}.
|
||||
\code{\link[=facet_sir]{facet_sir()}} creates 2d plots (at default based on S/I/R) using \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}}.
|
||||
|
||||
\code{\link[=scale_y_percent]{scale_y_percent()}} transforms the y axis to a 0 to 100\% range using \code{\link[ggplot2:scale_continuous]{ggplot2::scale_y_continuous()}}.
|
||||
|
||||
\code{\link[=scale_rsi_colours]{scale_rsi_colours()}} sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
||||
\code{\link[=scale_sir_colours]{scale_sir_colours()}} sets colours to the bars (green for S, yellow for I, and red for R). with multilingual support. The default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red.
|
||||
|
||||
\code{\link[=theme_rsi]{theme_rsi()}} is a [ggplot2 theme][\code{\link[ggplot2:theme]{ggplot2::theme()}} with minimal distraction.
|
||||
\code{\link[=theme_sir]{theme_sir()}} is a [ggplot2 theme][\code{\link[ggplot2:theme]{ggplot2::theme()}} with minimal distraction.
|
||||
|
||||
\code{\link[=labels_rsi_count]{labels_rsi_count()}} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2:geom_text]{ggplot2::geom_text()}}.
|
||||
\code{\link[=labels_sir_count]{labels_sir_count()}} print datalabels on the bars with percentage and amount of isolates using \code{\link[ggplot2:geom_text]{ggplot2::geom_text()}}.
|
||||
|
||||
\code{\link[=ggplot_rsi]{ggplot_rsi()}} is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (\verb{\%>\%}). See \emph{Examples}.
|
||||
\code{\link[=ggplot_sir]{ggplot_sir()}} is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (\verb{\%>\%}). See \emph{Examples}.
|
||||
}
|
||||
}
|
||||
\examples{
|
||||
@ -141,39 +141,39 @@ if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# get antimicrobial results for drugs against a UTI:
|
||||
ggplot(example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)) +
|
||||
geom_rsi()
|
||||
geom_sir()
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# prettify the plot using some additional functions:
|
||||
df <- example_isolates \%>\% select(AMX, NIT, FOS, TMP, CIP)
|
||||
ggplot(df) +
|
||||
geom_rsi() +
|
||||
geom_sir() +
|
||||
scale_y_percent() +
|
||||
scale_rsi_colours() +
|
||||
labels_rsi_count() +
|
||||
theme_rsi()
|
||||
scale_sir_colours() +
|
||||
labels_sir_count() +
|
||||
theme_sir()
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# or better yet, simplify this using the wrapper function - a single command:
|
||||
example_isolates \%>\%
|
||||
select(AMX, NIT, FOS, TMP, CIP) \%>\%
|
||||
ggplot_rsi()
|
||||
ggplot_sir()
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# get only proportions and no counts:
|
||||
example_isolates \%>\%
|
||||
select(AMX, NIT, FOS, TMP, CIP) \%>\%
|
||||
ggplot_rsi(datalabels = FALSE)
|
||||
ggplot_sir(datalabels = FALSE)
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# add other ggplot2 arguments as you like:
|
||||
example_isolates \%>\%
|
||||
select(AMX, NIT, FOS, TMP, CIP) \%>\%
|
||||
ggplot_rsi(
|
||||
ggplot_sir(
|
||||
width = 0.5,
|
||||
colour = "black",
|
||||
size = 1,
|
||||
@ -186,7 +186,7 @@ if (require("ggplot2") && require("dplyr")) {
|
||||
# you can alter the colours with colour names:
|
||||
example_isolates \%>\%
|
||||
select(AMX) \%>\%
|
||||
ggplot_rsi(colours = c(SI = "yellow"))
|
||||
ggplot_sir(colours = c(SI = "yellow"))
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
@ -199,7 +199,7 @@ if (require("ggplot2") && require("dplyr")) {
|
||||
) \%>\%
|
||||
ggplot() +
|
||||
geom_col(aes(x = x, y = y, fill = z)) +
|
||||
scale_rsi_colours(Value4 = "S", Value5 = "I", Value6 = "R")
|
||||
scale_sir_colours(Value4 = "S", Value5 = "I", Value6 = "R")
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
@ -213,14 +213,14 @@ if (require("ggplot2") && require("dplyr")) {
|
||||
# age_groups() is also a function in this AMR package:
|
||||
group_by(age_group = age_groups(age)) \%>\%
|
||||
select(age_group, CIP) \%>\%
|
||||
ggplot_rsi(x = "age_group")
|
||||
ggplot_sir(x = "age_group")
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
# a shorter version which also adjusts data label colours:
|
||||
example_isolates \%>\%
|
||||
select(AMX, NIT, FOS, TMP, CIP) \%>\%
|
||||
ggplot_rsi(colours = FALSE)
|
||||
ggplot_sir(colours = FALSE)
|
||||
}
|
||||
if (require("ggplot2") && require("dplyr")) {
|
||||
|
||||
@ -230,7 +230,7 @@ if (require("ggplot2") && require("dplyr")) {
|
||||
# select only UTI-specific drugs
|
||||
select(ward, AMX, NIT, FOS, TMP, CIP) \%>\%
|
||||
group_by(ward) \%>\%
|
||||
ggplot_rsi(
|
||||
ggplot_sir(
|
||||
x = "ward",
|
||||
facet = "antibiotic",
|
||||
nrow = 1,
|
@ -8,7 +8,7 @@ guess_ab_col(
|
||||
x = NULL,
|
||||
search_string = NULL,
|
||||
verbose = FALSE,
|
||||
only_rsi_columns = FALSE
|
||||
only_sir_columns = FALSE
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
@ -18,7 +18,7 @@ guess_ab_col(
|
||||
|
||||
\item{verbose}{a \link{logical} to indicate whether additional info should be printed}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_sir_columns}{a \link{logical} to indicate whether only antibiotic columns must be detected that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (defaults to \code{FALSE})}
|
||||
}
|
||||
\value{
|
||||
A column name of \code{x}, or \code{NULL} when no result is found.
|
||||
|
@ -17,11 +17,11 @@ key_antimicrobials(
|
||||
"oxacillin", "rifampin"),
|
||||
antifungal = c("anidulafungin", "caspofungin", "fluconazole", "miconazole", "nystatin",
|
||||
"voriconazole"),
|
||||
only_rsi_columns = FALSE,
|
||||
only_sir_columns = FALSE,
|
||||
...
|
||||
)
|
||||
|
||||
all_antimicrobials(x = NULL, only_rsi_columns = FALSE, ...)
|
||||
all_antimicrobials(x = NULL, only_sir_columns = FALSE, ...)
|
||||
|
||||
antimicrobials_equal(
|
||||
y,
|
||||
@ -45,7 +45,7 @@ antimicrobials_equal(
|
||||
|
||||
\item{antifungal}{names of antifungal drugs for \strong{fungi}, case-insensitive. Set to \code{NULL} to ignore. See \emph{Details} for the default antifungal drugs}
|
||||
|
||||
\item{only_rsi_columns}{a \link{logical} to indicate whether only columns must be included that were transformed to class \code{rsi} (see \code{\link[=as.rsi]{as.rsi()}}) on beforehand (defaults to \code{FALSE})}
|
||||
\item{only_sir_columns}{a \link{logical} to indicate whether only columns must be included that were transformed to class \code{sir} (see \code{\link[=as.sir]{as.sir()}}) on beforehand (defaults to \code{FALSE})}
|
||||
|
||||
\item{...}{ignored, only in place to allow future extensions}
|
||||
|
||||
|
31
man/mdro.Rd
31
man/mdro.Rd
File diff suppressed because one or more lines are too long
@ -2,21 +2,21 @@
|
||||
% Please edit documentation in R/mean_amr_distance.R
|
||||
\name{mean_amr_distance}
|
||||
\alias{mean_amr_distance}
|
||||
\alias{mean_amr_distance.rsi}
|
||||
\alias{mean_amr_distance.sir}
|
||||
\alias{mean_amr_distance.data.frame}
|
||||
\alias{amr_distance_from_row}
|
||||
\title{Calculate the Mean AMR Distance}
|
||||
\usage{
|
||||
mean_amr_distance(x, ...)
|
||||
|
||||
\method{mean_amr_distance}{rsi}(x, ..., combine_SI = TRUE)
|
||||
\method{mean_amr_distance}{sir}(x, ..., combine_SI = TRUE)
|
||||
|
||||
\method{mean_amr_distance}{data.frame}(x, ..., combine_SI = TRUE)
|
||||
|
||||
amr_distance_from_row(amr_distance, row)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a vector of class \link[=as.rsi]{rsi}, \link[=as.mic]{mic} or \link[=as.disk]{disk}, or a \link{data.frame} containing columns of any of these classes}
|
||||
\item{x}{a vector of class \link[=as.sir]{sir}, \link[=as.mic]{mic} or \link[=as.disk]{disk}, or a \link{data.frame} containing columns of any of these classes}
|
||||
|
||||
\item{...}{variables to select (supports \link[tidyselect:language]{tidyselect language} such as \code{column1:column4} and \code{where(is.mic)}, and can thus also be \link[=ab_selector]{antibiotic selectors}}
|
||||
|
||||
@ -34,7 +34,7 @@ The mean AMR distance is effectively \href{https://en.wikipedia.org/wiki/Standar
|
||||
|
||||
MIC values (see \code{\link[=as.mic]{as.mic()}}) are transformed with \code{\link[=log2]{log2()}} first; their distance is thus calculated as \code{(log2(x) - mean(log2(x))) / sd(log2(x))}.
|
||||
|
||||
R/SI values (see \code{\link[=as.rsi]{as.rsi()}}) are transformed using \code{"S"} = 1, \code{"I"} = 2, and \code{"R"} = 3. If \code{combine_SI} is \code{TRUE} (default), the \code{"I"} will be considered to be 1.
|
||||
SIR values (see \code{\link[=as.sir]{as.sir()}}) are transformed using \code{"S"} = 1, \code{"I"} = 2, and \code{"R"} = 3. If \code{combine_SI} is \code{TRUE} (default), the \code{"I"} will be considered to be 1.
|
||||
|
||||
For data sets, the mean AMR distance will be calculated per column, after which the mean per row will be returned, see \emph{Examples}.
|
||||
|
||||
@ -46,9 +46,9 @@ Isolates with distances less than 0.01 difference from each other should be cons
|
||||
}
|
||||
|
||||
\examples{
|
||||
rsi <- random_rsi(10)
|
||||
rsi
|
||||
mean_amr_distance(rsi)
|
||||
sir <- random_sir(10)
|
||||
sir
|
||||
mean_amr_distance(sir)
|
||||
|
||||
mic <- random_mic(10)
|
||||
mic
|
||||
@ -62,7 +62,7 @@ mean_amr_distance(disk)
|
||||
|
||||
y <- data.frame(
|
||||
id = LETTERS[1:10],
|
||||
amox = random_rsi(10, ab = "amox", mo = "Escherichia coli"),
|
||||
amox = random_sir(10, ab = "amox", mo = "Escherichia coli"),
|
||||
cipr = random_disk(10, ab = "cipr", mo = "Escherichia coli"),
|
||||
gent = random_mic(10, ab = "gent", mo = "Escherichia coli"),
|
||||
tobr = random_mic(10, ab = "tobr", mo = "Escherichia coli")
|
||||
|
@ -59,7 +59,7 @@ All matches are sorted descending on their matching score and for all user input
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -345,7 +345,7 @@ This function uses \code{\link[=as.mo]{as.mo()}} internally, which uses an advan
|
||||
|
||||
\section{Reference Data Publicly Available}{
|
||||
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
|
@ -72,7 +72,7 @@ if (require("dplyr")) {
|
||||
genus = mo_genus(mo)
|
||||
) \%>\% # and genus as we do here;
|
||||
filter(n() >= 30) \%>\% # filter on only 30 results per group
|
||||
summarise_if(is.rsi, resistance) # then get resistance of all drugs
|
||||
summarise_if(is.sir, resistance) # then get resistance of all drugs
|
||||
|
||||
# now conduct PCA for certain antimicrobial drugs
|
||||
pca_result <- resistance_data \%>\%
|
||||
|
36
man/plot.Rd
36
man/plot.Rd
@ -8,10 +8,10 @@
|
||||
\alias{plot.disk}
|
||||
\alias{autoplot.disk}
|
||||
\alias{fortify.disk}
|
||||
\alias{plot.rsi}
|
||||
\alias{autoplot.rsi}
|
||||
\alias{fortify.rsi}
|
||||
\title{Plotting for Classes \code{rsi}, \code{mic} and \code{disk}}
|
||||
\alias{plot.sir}
|
||||
\alias{autoplot.sir}
|
||||
\alias{fortify.sir}
|
||||
\title{Plotting for Classes \code{sir}, \code{mic} and \code{disk}}
|
||||
\usage{
|
||||
\method{plot}{mic}(
|
||||
x,
|
||||
@ -21,7 +21,7 @@
|
||||
main = deparse(substitute(x)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
colours_SIR = c("#3CAEA3", "#F6D55C", "#ED553B"),
|
||||
language = get_AMR_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
@ -35,7 +35,7 @@
|
||||
title = deparse(substitute(object)),
|
||||
ylab = "Frequency",
|
||||
xlab = "Minimum Inhibitory Concentration (mg/L)",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
colours_SIR = c("#3CAEA3", "#F6D55C", "#ED553B"),
|
||||
language = get_AMR_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
@ -51,7 +51,7 @@
|
||||
mo = NULL,
|
||||
ab = NULL,
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
colours_SIR = c("#3CAEA3", "#F6D55C", "#ED553B"),
|
||||
language = get_AMR_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
@ -65,7 +65,7 @@
|
||||
ylab = "Frequency",
|
||||
xlab = "Disk diffusion diameter (mm)",
|
||||
guideline = "EUCAST",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
colours_SIR = c("#3CAEA3", "#F6D55C", "#ED553B"),
|
||||
language = get_AMR_locale(),
|
||||
expand = TRUE,
|
||||
...
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
\method{fortify}{disk}(object, ...)
|
||||
|
||||
\method{plot}{rsi}(
|
||||
\method{plot}{sir}(
|
||||
x,
|
||||
ylab = "Percentage",
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
@ -82,20 +82,20 @@
|
||||
...
|
||||
)
|
||||
|
||||
\method{autoplot}{rsi}(
|
||||
\method{autoplot}{sir}(
|
||||
object,
|
||||
title = deparse(substitute(object)),
|
||||
xlab = "Antimicrobial Interpretation",
|
||||
ylab = "Frequency",
|
||||
colours_RSI = c("#ED553B", "#3CAEA3", "#F6D55C"),
|
||||
colours_SIR = c("#3CAEA3", "#F6D55C", "#ED553B"),
|
||||
language = get_AMR_locale(),
|
||||
...
|
||||
)
|
||||
|
||||
\method{fortify}{rsi}(object, ...)
|
||||
\method{fortify}{sir}(object, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x, object}{values created with \code{\link[=as.mic]{as.mic()}}, \code{\link[=as.disk]{as.disk()}} or \code{\link[=as.rsi]{as.rsi()}} (or their \verb{random_*} variants, such as \code{\link[=random_mic]{random_mic()}})}
|
||||
\item{x, object}{values created with \code{\link[=as.mic]{as.mic()}}, \code{\link[=as.disk]{as.disk()}} or \code{\link[=as.sir]{as.sir()}} (or their \verb{random_*} variants, such as \code{\link[=random_mic]{random_mic()}})}
|
||||
|
||||
\item{mo}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
|
||||
\item{xlab, ylab}{axis title}
|
||||
|
||||
\item{colours_RSI}{colours to use for filling in the bars, must be a vector of three values (in the order R, S and I). The default colours are colour-blind friendly.}
|
||||
\item{colours_SIR}{colours to use for filling in the bars, must be a vector of three values (in the order S, I and R). The default colours are colour-blind friendly.}
|
||||
|
||||
\item{language}{language to be used to translate 'Susceptible', 'Increased exposure'/'Intermediate' and 'Resistant', defaults to system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can be overwritten by setting the option \code{AMR_locale}, e.g. \code{options(AMR_locale = "de")}, see \link{translate}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
@ -121,7 +121,7 @@ The \code{autoplot()} functions return a \code{\link[ggplot2:ggplot]{ggplot}} mo
|
||||
The \code{fortify()} functions return a \link{data.frame} as an extension for usage in the \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} function.
|
||||
}
|
||||
\description{
|
||||
Functions to plot classes \code{rsi}, \code{mic} and \code{disk}, with support for base \R and \code{ggplot2}.
|
||||
Functions to plot classes \code{sir}, \code{mic} and \code{disk}, with support for base \R and \code{ggplot2}.
|
||||
}
|
||||
\details{
|
||||
The interpretation of "I" will be named "Increased exposure" for all EUCAST guidelines since 2019, and will be named "Intermediate" in all other cases.
|
||||
@ -133,11 +133,11 @@ Simply using \code{"CLSI"} or \code{"EUCAST"} as input will automatically select
|
||||
\examples{
|
||||
some_mic_values <- random_mic(size = 100)
|
||||
some_disk_values <- random_disk(size = 100, mo = "Escherichia coli", ab = "cipro")
|
||||
some_rsi_values <- random_rsi(50, prob_RSI = c(0.30, 0.55, 0.05))
|
||||
some_sir_values <- random_sir(50, prob_SIR = c(0.55, 0.05, 0.30))
|
||||
|
||||
plot(some_mic_values)
|
||||
plot(some_disk_values)
|
||||
plot(some_rsi_values)
|
||||
plot(some_sir_values)
|
||||
|
||||
# when providing the microorganism and antibiotic, colours will show interpretations:
|
||||
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||
@ -152,7 +152,7 @@ if (require("ggplot2")) {
|
||||
autoplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
}
|
||||
if (require("ggplot2")) {
|
||||
autoplot(some_rsi_values)
|
||||
autoplot(some_sir_values)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/proportion.R, R/rsi_df.R
|
||||
% Please edit documentation in R/proportion.R, R/sir_df.R
|
||||
\name{proportion}
|
||||
\alias{proportion}
|
||||
\alias{resistance}
|
||||
\alias{portion}
|
||||
\alias{susceptibility}
|
||||
\alias{rsi_confidence_interval}
|
||||
\alias{sir_confidence_interval}
|
||||
\alias{proportion_R}
|
||||
\alias{proportion_IR}
|
||||
\alias{proportion_I}
|
||||
\alias{proportion_SI}
|
||||
\alias{proportion_S}
|
||||
\alias{proportion_df}
|
||||
\alias{rsi_df}
|
||||
\alias{sir_df}
|
||||
\title{Calculate Microbial Resistance}
|
||||
\source{
|
||||
\strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 5th Edition}, 2022, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
|
||||
@ -22,7 +22,7 @@ resistance(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
|
||||
|
||||
susceptibility(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
|
||||
|
||||
rsi_confidence_interval(
|
||||
sir_confidence_interval(
|
||||
...,
|
||||
ab_result = "R",
|
||||
minimum = 30,
|
||||
@ -52,7 +52,7 @@ proportion_df(
|
||||
confidence_level = 0.95
|
||||
)
|
||||
|
||||
rsi_df(
|
||||
sir_df(
|
||||
data,
|
||||
translate_ab = "name",
|
||||
language = get_AMR_locale(),
|
||||
@ -63,7 +63,7 @@ rsi_df(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{...}{one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.rsi]{as.rsi()}} if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See \emph{Examples}.}
|
||||
\item{...}{one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See \emph{Examples}.}
|
||||
|
||||
\item{minimum}{the minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see \emph{Source}.}
|
||||
|
||||
@ -71,13 +71,13 @@ rsi_df(
|
||||
|
||||
\item{only_all_tested}{(for combination therapies, i.e. using more than one variable for \code{...}): a \link{logical} to indicate that isolates must be tested for all antibiotics, see section \emph{Combination Therapy} below}
|
||||
|
||||
\item{ab_result}{antibiotic results to test against, must be one of more values of "R", "S", "I"}
|
||||
\item{ab_result}{antibiotic results to test against, must be one or more values of "S", "I", or "R"}
|
||||
|
||||
\item{confidence_level}{the confidence level for the returned confidence interval. For the calculation, the number of S or SI isolates, and R isolates are compared with the total number of available isolates with R, S, or I by using \code{\link[=binom.test]{binom.test()}}, i.e., the Clopper-Pearson method.}
|
||||
|
||||
\item{side}{the side of the confidence interval to return. Defaults to \code{"both"} for a length 2 vector, but can also be (abbreviated as) \code{"min"}/\code{"left"}/\code{"lower"}/\code{"less"} or \code{"max"}/\code{"right"}/\code{"higher"}/\code{"greater"}.}
|
||||
|
||||
\item{data}{a \link{data.frame} containing columns with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}})}
|
||||
\item{data}{a \link{data.frame} containing columns with class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}})}
|
||||
|
||||
\item{translate_ab}{a column name of the \link{antibiotics} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}}
|
||||
|
||||
@ -96,13 +96,13 @@ These functions can be used to calculate the (co-)resistance or susceptibility o
|
||||
\details{
|
||||
The function \code{\link[=resistance]{resistance()}} is equal to the function \code{\link[=proportion_R]{proportion_R()}}. The function \code{\link[=susceptibility]{susceptibility()}} is equal to the function \code{\link[=proportion_SI]{proportion_SI()}}.
|
||||
|
||||
Use \code{\link[=rsi_confidence_interval]{rsi_confidence_interval()}} to calculate the confidence interval, which relies on \code{\link[=binom.test]{binom.test()}}, i.e., the Clopper-Pearson method. This function returns a vector of length 2 at default for antimicrobial \emph{resistance}. Change the \code{side} argument to "left"/"min" or "right"/"max" to return a single value, and change the \code{ab_result} argument to e.g. \code{c("S", "I")} to test for antimicrobial \emph{susceptibility}, see Examples.
|
||||
Use \code{\link[=sir_confidence_interval]{sir_confidence_interval()}} to calculate the confidence interval, which relies on \code{\link[=binom.test]{binom.test()}}, i.e., the Clopper-Pearson method. This function returns a vector of length 2 at default for antimicrobial \emph{resistance}. Change the \code{side} argument to "left"/"min" or "right"/"max" to return a single value, and change the \code{ab_result} argument to e.g. \code{c("S", "I")} to test for antimicrobial \emph{susceptibility}, see Examples.
|
||||
|
||||
\strong{Remember that you should filter your data to let it contain only first isolates!} This is needed to exclude duplicates and to reduce selection bias. Use \code{\link[=first_isolate]{first_isolate()}} to determine them in your data set.
|
||||
|
||||
These functions are not meant to count isolates, but to calculate the proportion of resistance/susceptibility. Use the \code{\link[=count]{count()}} functions to count isolates. The function \code{\link[=susceptibility]{susceptibility()}} is essentially equal to \code{count_susceptible() / count_all()}. \emph{Low counts can influence the outcome - the \code{proportion} functions may camouflage this, since they only return the proportion (albeit being dependent on the \code{minimum} argument).}
|
||||
|
||||
The function \code{\link[=proportion_df]{proportion_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and calculates the proportions R, I and S. It also supports grouped variables. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=proportion_df]{proportion_df()}}, but adds the number of isolates.
|
||||
The function \code{\link[=proportion_df]{proportion_df()}} takes any variable from \code{data} that has an \code{\link{sir}} class (created with \code{\link[=as.sir]{as.sir()}}) and calculates the proportions S, I, and R. It also supports grouped variables. The function \code{\link[=sir_df]{sir_df()}} works exactly like \code{\link[=proportion_df]{proportion_df()}}, but adds the number of isolates.
|
||||
}
|
||||
\section{Combination Therapy}{
|
||||
|
||||
@ -141,16 +141,19 @@ and that, in combination therapies, for \code{only_all_tested = FALSE} applies t
|
||||
Using \code{only_all_tested} has no impact when only using one antibiotic as input.
|
||||
}
|
||||
|
||||
\section{Interpretation of R and S/I}{
|
||||
\section{Interpretation of SIR}{
|
||||
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (\url{https://www.eucast.org/newsiandr/}).
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (\url{https://www.eucast.org/newsiandr/}):
|
||||
\itemize{
|
||||
\item \strong{S - Susceptible, standard dosing regimen}\cr
|
||||
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} \emph{\cr
|
||||
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}\cr
|
||||
A microorganism is categorised as \emph{Resistant} when there is a high likelihood of therapeutic failure even when there is increased exposure. 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.
|
||||
\item \strong{S = Susceptible}\cr
|
||||
A microorganism is categorised as \emph{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}\cr
|
||||
A microorganism is categorised as \emph{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.
|
||||
A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.
|
||||
\itemize{
|
||||
\item \emph{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 insight. Use \code{\link[=susceptibility]{susceptibility()}} (equal to \code{\link[=proportion_SI]{proportion_SI()}}) to determine antimicrobial susceptibility and \code{\link[=count_susceptible]{count_susceptible()}} (equal to \code{\link[=count_SI]{count_SI()}}) to count susceptible isolates.
|
||||
@ -163,14 +166,14 @@ This AMR package honours this insight. Use \code{\link[=susceptibility]{suscepti
|
||||
# base R ------------------------------------------------------------
|
||||
# determines \%R
|
||||
resistance(example_isolates$AMX)
|
||||
rsi_confidence_interval(example_isolates$AMX)
|
||||
rsi_confidence_interval(example_isolates$AMX,
|
||||
sir_confidence_interval(example_isolates$AMX)
|
||||
sir_confidence_interval(example_isolates$AMX,
|
||||
confidence_level = 0.975
|
||||
)
|
||||
|
||||
# determines \%S+I:
|
||||
susceptibility(example_isolates$AMX)
|
||||
rsi_confidence_interval(example_isolates$AMX,
|
||||
sir_confidence_interval(example_isolates$AMX,
|
||||
ab_result = c("S", "I")
|
||||
)
|
||||
|
||||
@ -188,16 +191,16 @@ if (require("dplyr")) {
|
||||
group_by(ward) \%>\%
|
||||
summarise(
|
||||
r = resistance(CIP),
|
||||
n = n_rsi(CIP)
|
||||
) # n_rsi works like n_distinct in dplyr, see ?n_rsi
|
||||
n = n_sir(CIP)
|
||||
) # n_sir works like n_distinct in dplyr, see ?n_sir
|
||||
}
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
group_by(ward) \%>\%
|
||||
summarise(
|
||||
cipro_R = resistance(CIP),
|
||||
ci_min = rsi_confidence_interval(CIP, side = "min"),
|
||||
ci_max = rsi_confidence_interval(CIP, side = "max"),
|
||||
ci_min = sir_confidence_interval(CIP, side = "min"),
|
||||
ci_max = sir_confidence_interval(CIP, side = "max"),
|
||||
)
|
||||
}
|
||||
if (require("dplyr")) {
|
||||
@ -218,7 +221,7 @@ if (require("dplyr")) {
|
||||
R = resistance(CIP, as_percent = TRUE),
|
||||
SI = susceptibility(CIP, as_percent = TRUE),
|
||||
n1 = count_all(CIP), # the actual total; sum of all three
|
||||
n2 = n_rsi(CIP), # same - analogous to n_distinct
|
||||
n2 = n_sir(CIP), # same - analogous to n_distinct
|
||||
total = n()
|
||||
) # NOT the number of tested isolates!
|
||||
|
||||
@ -261,17 +264,17 @@ if (require("dplyr")) {
|
||||
combination_n = count_all(CIP, GEN)
|
||||
)
|
||||
|
||||
# Get proportions S/I/R immediately of all rsi columns
|
||||
# Get proportions S/I/R immediately of all sir columns
|
||||
example_isolates \%>\%
|
||||
select(AMX, CIP) \%>\%
|
||||
proportion_df(translate = FALSE)
|
||||
|
||||
# It also supports grouping variables
|
||||
# (use rsi_df to also include the count)
|
||||
# (use sir_df to also include the count)
|
||||
example_isolates \%>\%
|
||||
select(ward, AMX, CIP) \%>\%
|
||||
group_by(ward) \%>\%
|
||||
rsi_df(translate = FALSE)
|
||||
sir_df(translate = FALSE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
\alias{random}
|
||||
\alias{random_mic}
|
||||
\alias{random_disk}
|
||||
\alias{random_rsi}
|
||||
\title{Random MIC Values/Disk Zones/RSI Generation}
|
||||
\alias{random_sir}
|
||||
\title{Random MIC Values/Disk Zones/SIR Generation}
|
||||
\usage{
|
||||
random_mic(size = NULL, mo = NULL, ab = NULL, ...)
|
||||
|
||||
random_disk(size = NULL, mo = NULL, ab = NULL, ...)
|
||||
|
||||
random_rsi(size = NULL, prob_RSI = c(0.33, 0.33, 0.33), ...)
|
||||
random_sir(size = NULL, prob_SIR = c(0.33, 0.33, 0.33), ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{size}{desired size of the returned vector. If used in a \link{data.frame} call or \code{dplyr} verb, will get the current (group) size if left blank.}
|
||||
@ -22,7 +22,7 @@ random_rsi(size = NULL, prob_RSI = c(0.33, 0.33, 0.33), ...)
|
||||
|
||||
\item{...}{ignored, only in place to allow future extensions}
|
||||
|
||||
\item{prob_RSI}{a vector of length 3: the probabilities for "R" (1st value), "S" (2nd value) and "I" (3rd value)}
|
||||
\item{prob_SIR}{a vector of length 3: the probabilities for "S" (1st value), "I" (2nd value) and "R" (3rd value)}
|
||||
}
|
||||
\value{
|
||||
class \code{mic} for \code{\link[=random_mic]{random_mic()}} (see \code{\link[=as.mic]{as.mic()}}) and class \code{disk} for \code{\link[=random_disk]{random_disk()}} (see \code{\link[=as.disk]{as.disk()}})
|
||||
@ -33,12 +33,12 @@ These functions can be used for generating random MIC values and disk diffusion
|
||||
\details{
|
||||
The base \R function \code{\link[=sample]{sample()}} is used for generating values.
|
||||
|
||||
Generated values are based on the EUCAST 2022 guideline as implemented in the \link{rsi_translation} data set. To create specific generated values per bug or drug, set the \code{mo} and/or \code{ab} argument.
|
||||
Generated values are based on the EUCAST 2022 guideline as implemented in the \link{clinical_breakpoints} data set. To create specific generated values per bug or drug, set the \code{mo} and/or \code{ab} argument.
|
||||
}
|
||||
\examples{
|
||||
random_mic(25)
|
||||
random_disk(25)
|
||||
random_rsi(25)
|
||||
random_sir(25)
|
||||
|
||||
\donttest{
|
||||
# make the random generation more realistic by setting a bug and/or drug:
|
||||
|
@ -2,9 +2,9 @@
|
||||
% Please edit documentation in R/resistance_predict.R
|
||||
\name{resistance_predict}
|
||||
\alias{resistance_predict}
|
||||
\alias{rsi_predict}
|
||||
\alias{sir_predict}
|
||||
\alias{plot.resistance_predict}
|
||||
\alias{ggplot_rsi_predict}
|
||||
\alias{ggplot_sir_predict}
|
||||
\alias{autoplot.resistance_predict}
|
||||
\title{Predict Antimicrobial Resistance}
|
||||
\usage{
|
||||
@ -23,7 +23,7 @@ resistance_predict(
|
||||
...
|
||||
)
|
||||
|
||||
rsi_predict(
|
||||
sir_predict(
|
||||
x,
|
||||
col_ab,
|
||||
col_date = NULL,
|
||||
@ -40,7 +40,7 @@ rsi_predict(
|
||||
|
||||
\method{plot}{resistance_predict}(x, main = paste("Resistance Prediction of", x_name), ...)
|
||||
|
||||
ggplot_rsi_predict(
|
||||
ggplot_sir_predict(
|
||||
x,
|
||||
main = paste("Resistance Prediction of", x_name),
|
||||
ribbon = TRUE,
|
||||
@ -110,16 +110,19 @@ Valid options for the statistical model (argument \code{model}) are:
|
||||
\item \code{"lin"} or \code{"linear"}: a linear regression model
|
||||
}
|
||||
}
|
||||
\section{Interpretation of R and S/I}{
|
||||
\section{Interpretation of SIR}{
|
||||
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories R and S/I as shown below (\url{https://www.eucast.org/newsiandr/}).
|
||||
In 2019, the European Committee on Antimicrobial Susceptibility Testing (EUCAST) has decided to change the definitions of susceptibility testing categories S, I, and R as shown below (\url{https://www.eucast.org/newsiandr/}):
|
||||
\itemize{
|
||||
\item \strong{S - Susceptible, standard dosing regimen}\cr
|
||||
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} \emph{\cr
|
||||
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}\cr
|
||||
A microorganism is categorised as \emph{Resistant} when there is a high likelihood of therapeutic failure even when there is increased exposure. 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.
|
||||
\item \strong{S = Susceptible}\cr
|
||||
A microorganism is categorised as \emph{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}\cr
|
||||
A microorganism is categorised as \emph{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.
|
||||
A microorganism is categorised as "Resistant" when there is a high likelihood of therapeutic failure even when there is increased exposure.
|
||||
\itemize{
|
||||
\item \emph{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 insight. Use \code{\link[=susceptibility]{susceptibility()}} (equal to \code{\link[=proportion_SI]{proportion_SI()}}) to determine antimicrobial susceptibility and \code{\link[=count_susceptible]{count_susceptible()}} (equal to \code{\link[=count_SI]{count_SI()}}) to count susceptible isolates.
|
||||
@ -134,7 +137,7 @@ x <- resistance_predict(example_isolates,
|
||||
plot(x)
|
||||
\donttest{
|
||||
if (require("ggplot2")) {
|
||||
ggplot_rsi_predict(x)
|
||||
ggplot_sir_predict(x)
|
||||
}
|
||||
|
||||
# using dplyr:
|
||||
|
Reference in New Issue
Block a user