Compare commits

...

3 Commits

29 changed files with 876 additions and 2269 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 1.8.1.9001
Date: 2022-04-08
Version: 1.8.1.9004
Date: 2022-05-09
Title: Antimicrobial Resistance Data Analysis
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
data analysis and to work with microbial and antimicrobial properties by

View File

@ -50,7 +50,6 @@ S3method(any,mic)
S3method(as.data.frame,ab)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.integer,mic)
S3method(as.list,custom_eucast_rules)
S3method(as.list,custom_mdro_guideline)
S3method(as.matrix,mic)

View File

@ -1,8 +1,11 @@
# `AMR` 1.8.1.9001
## <small>Last updated: 8 April 2022</small>
# `AMR` 1.8.1.9004
## <small>Last updated: 9 May 2022</small>
### Changed
* Removed `as.integer()` for MIC values, since MIC are not integer values and running `table()` on MIC values consequently failed for not being able to retrieve the level position (as that's how normally `as.integer()` on `factor`s work)
* `droplevels()` on MIC will now return a common `factor` at default and will lose the `<mic>` class. Use `droplevels(..., as.mic = TRUE)` to keep the `<mic>` class.
* Small fix for using `ab_from_text()`
* Fixes for reading in text files using `set_mo_source()`, which now also allows the source file to contain valid taxonomic names instead of only valid microorganism ID of this package
# `AMR` 1.8.1

26
R/mic.R
View File

@ -47,7 +47,7 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
#' @rdname as.mic
#' @param x a [character] or [numeric] vector
#' @param na.rm a [logical] indicating whether missing values should be removed
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST and CLSI.
#' @details To interpret MIC values as RSI values, use [as.rsi()] on MIC values. It supports guidelines from EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`).
#'
#' This class for MIC values is a quite a special data type: formally it is an ordered [factor] with valid MIC values as [factor] levels (to make sure only valid MIC values are retained), but for any mathematical operation it acts as decimal numbers:
#'
@ -86,6 +86,10 @@ valid_mic_levels <- c(c(t(vapply(FUN.VALUE = character(9), ops,
#' ```
#'
#' The following [generic functions][groupGeneric()] are implemented for the MIC class: `!`, `!=`, `%%`, `%/%`, `&`, `*`, `+`, `-`, `/`, `<`, `<=`, `==`, `>`, `>=`, `^`, `|`, [abs()], [acos()], [acosh()], [all()], [any()], [asin()], [asinh()], [atan()], [atanh()], [ceiling()], [cos()], [cosh()], [cospi()], [cummax()], [cummin()], [cumprod()], [cumsum()], [digamma()], [exp()], [expm1()], [floor()], [gamma()], [lgamma()], [log()], [log1p()], [log2()], [log10()], [max()], [mean()], [min()], [prod()], [range()], [round()], [sign()], [signif()], [sin()], [sinh()], [sinpi()], [sqrt()], [sum()], [tan()], [tanh()], [tanpi()], [trigamma()] and [trunc()]. Some functions of the `stats` package are also implemented: [median()], [quantile()], [mad()], [IQR()], [fivenum()]. Also, [boxplot.stats()] is supported. Since [sd()] and [var()] are non-generic functions, these could not be extended. Use [mad()] as an alternative, or use e.g. `sd(as.numeric(x))` where `x` is your vector of MIC values.
#'
#' Using [as.double()] or [as.numeric()] on MIC values will remove the operators and return a numeric vector. Do **not** use [as.integer()] on MIC values as by the \R convention on [factor]s, it will return the index of the factor levels (which is often useless for regular users).
#'
#' Use [droplevels()] to drop unused levels. At default, it will return a plain factor. Use `droplevels(..., as.mic = TRUE)` to maintain the `<mic>` class.
#' @return Ordered [factor] with additional class [`mic`], that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a [numeric] value.
#' @aliases mic
#' @export
@ -196,7 +200,8 @@ all_valid_mics <- function(x) {
}
#' @rdname as.mic
#' @details `NA_mic_` is a missing value of the new `<mic>` class.
#' @details `NA_mic_` is a missing value of the new `<mic>` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_mic_ <- set_clean_class(factor(NA, levels = valid_mic_levels, ordered = TRUE),
new_class = c("mic", "ordered", "factor"))
@ -214,13 +219,6 @@ as.double.mic <- function(x, ...) {
as.double(gsub("[<=>]+", "", as.character(x), perl = TRUE))
}
#' @method as.integer mic
#' @export
#' @noRd
as.integer.mic <- function(x, ...) {
as.integer(gsub("[<=>]+", "", as.character(x), perl = TRUE))
}
#' @method as.numeric mic
#' @export
#' @noRd
@ -228,10 +226,12 @@ as.numeric.mic <- function(x, ...) {
as.numeric(gsub("[<=>]+", "", as.character(x), perl = TRUE))
}
#' @rdname as.mic
#' @method droplevels mic
#' @param exclude factor levels which should be excluded from the result even if present, see [droplevels()][base::droplevels()]
#' @param as.mic a [logical] to indicate whether the `<mic>` class should be kept, defaults to `FALSE`
#' @export
#' @noRd
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = TRUE, ...) {
droplevels.mic <- function(x, exclude = if (any(is.na(levels(x)))) NULL else NA, as.mic = FALSE, ...) {
x <- droplevels.factor(x, exclude = exclude, ...)
if (as.mic == TRUE) {
class(x) <- c("mic", "ordered", "factor")
@ -260,7 +260,9 @@ type_sum.mic <- function(x, ...) {
#' @export
#' @noRd
print.mic <- function(x, ...) {
cat("Class <mic>\n")
cat("Class <mic>",
ifelse(length(levels(x)) < length(valid_mic_levels), font_red(" with dropped levels"), ""),
"\n", sep = "")
print(as.character(x), quote = FALSE)
att <- attributes(x)
if ("na.action" %in% names(att)) {

View File

@ -29,16 +29,16 @@
#'
#' This is **the fastest way** to have your organisation (or analysis) specific codes picked up and translated by this package, since you don't have to bother about it again after setting it up once.
#' @inheritSection lifecycle Stable Lifecycle
#' @param path location of your reference file, see *Details*. Can be `""`, `NULL` or `FALSE` to delete the reference file.
#' @param path location of your reference file, this can be any text file (comma-, tab- or pipe-separated) or an Excel file (see *Details*). Can also be `""`, `NULL` or `FALSE` to delete the reference file.
#' @param destination destination of the compressed data file, default to the user's home directory.
#' @rdname mo_source
#' @name mo_source
#' @aliases set_mo_source get_mo_source
#' @details The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an \R object file (extension '.rds'). To use an Excel file, you will need to have the `readxl` package installed.
#'
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
#' [set_mo_source()] will check the file for validity: it must be a [data.frame], must have a column named `"mo"` which contains values from [`microorganisms$mo`][microorganisms] or [`microorganisms$fullname`][microorganisms] and must have a reference column with your own defined values. If all tests pass, [set_mo_source()] will read the file into \R and will ask to export it to `"~/mo_source.rds"`. The CRAN policy disallows packages to write to the file system, although '*exceptions may be allowed in interactive sessions if the package obtains confirmation from the user*'. For this reason, this function only works in interactive sessions so that the user can **specifically confirm and allow** that this file will be created. The destination of this file can be set with the `destination` argument and defaults to the user's home directory. It can also be set as an \R option, using `options(AMR_mo_source = "my/location/file.rds")`.
#'
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
#' The created compressed data file `"mo_source.rds"` will be used at default for MO determination (function [as.mo()] and consequently all `mo_*` functions like [mo_genus()] and [mo_gramstain()]). The location and timestamp of the original file will be saved as an [attribute][base::attributes()] to the compressed data file.
#'
#' The function [get_mo_source()] will return the data set by reading `"mo_source.rds"` with [readRDS()]. If the original file has changed (by checking the location and timestamp of the original file), it will call [set_mo_source()] to update the data file automatically if used in an interactive session.
#'
@ -46,15 +46,15 @@
#'
#' @section How to Setup:
#'
#' Imagine this data on a sheet of an Excel file (mo codes were looked up in the [microorganisms] data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:
#' Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:
#'
#' ```
#' | A | B |
#' --|--------------------|--------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
#' 4 | | |
#' | A | B |
#' --|--------------------|-----------------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | Escherichia coli |
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
#' 4 | | |
#' ```
#'
#' We save it as `"home/me/ourcodes.xlsx"`. Now we have to set it as a source:
@ -89,13 +89,13 @@
#' If we edit the Excel file by, let's say, adding row 4 like this:
#'
#' ```
#' | A | B |
#' --|--------------------|--------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | B_ESCHR_COLI |
#' 3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
#' 4 | lab_Staph_aureus | B_STPHY_AURS |
#' 5 | | |
#' | A | B |
#' --|--------------------|-----------------------|
#' 1 | Organisation XYZ | mo |
#' 2 | lab_mo_ecoli | Escherichia coli |
#' 3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
#' 4 | lab_Staph_aureus | Staphylococcus aureus |
#' 5 | | |
#' ```
#'
#' ...any new usage of an MO function in this package will update your data file:
@ -144,6 +144,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
stop_ifnot(file.exists(path), "file not found: ", path)
df <- NULL
if (path %like% "[.]rds$") {
df <- readRDS(path)
@ -153,28 +154,34 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
df <- readxl::read_excel(path)
} else if (path %like% "[.]tsv$") {
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE)
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
} else if (path %like% "[.]csv$") {
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE)
} else {
# try comma first
try(
df <- utils::read.table(header = TRUE, sep = ",", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = ",", stringsAsFactors = FALSE),
silent = TRUE)
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
# try tab
try(
df <- utils::read.table(header = TRUE, sep = "\t", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = "\t", stringsAsFactors = FALSE),
silent = TRUE)
}
if (!check_validity_mo_source(df, stop_on_error = FALSE)) {
# try pipe
try(
df <- utils::read.table(header = TRUE, sep = "|", stringsAsFactors = FALSE),
df <- utils::read.table(file = path, header = TRUE, sep = "|", stringsAsFactors = FALSE),
silent = TRUE)
}
}
# check integrity
if (is.null(df)) {
stop_("the path '", path, "' could not be imported as a dataset.")
}
check_validity_mo_source(df)
df <- subset(df, !is.na(mo))
@ -187,7 +194,7 @@ set_mo_source <- function(path, destination = getOption("AMR_mo_source", "~/mo_s
}
df <- as.data.frame(df, stringAsFactors = FALSE)
df[, "mo"] <- set_clean_class(df[, "mo", drop = TRUE], c("mo", "character"))
df[, "mo"] <- as.mo(df[, "mo", drop = TRUE])
# success
if (file.exists(mo_source_destination)) {
@ -275,9 +282,9 @@ check_validity_mo_source <- function(x, refer_to_name = "`reference_df`", stop_o
return(FALSE)
}
}
if (!all(x$mo %in% c("", microorganisms$mo), na.rm = TRUE)) {
if (!all(x$mo %in% c("", microorganisms$mo, microorganisms$fullname), na.rm = TRUE)) {
if (stop_on_error == TRUE) {
invalid <- x[which(!x$mo %in% c("", microorganisms$mo)), , drop = FALSE]
invalid <- x[which(!x$mo %in% c("", microorganisms$mo, microorganisms$fullname)), , drop = FALSE]
if (nrow(invalid) > 1) {
plural <- "s"
} else {

View File

@ -33,7 +33,7 @@
#' @param ab any (vector of) text that can be coerced to a valid antimicrobial code with [as.ab()]
#' @param uti (Urinary Tract Infection) A vector with [logical]s (`TRUE` or `FALSE`) to specify whether a UTI specific interpretation from the guideline should be chosen. For using [as.rsi()] on a [data.frame], this can also be a column containing [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 *Examples*.
#' @inheritParams first_isolate
#' @param guideline defaults to the latest included EUCAST guideline, see *Details* for all options
#' @param guideline defaults to the latest included EUCAST guideline, supports EUCAST (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "EUCAST")$guideline)))`) and CLSI (`r min(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`-`r max(as.integer(gsub("[^0-9]", "", subset(rsi_translation, guideline %like% "CLSI")$guideline)))`), see *Details*
#' @param conserve_capped_values a [logical] to indicate that MIC values starting with `">"` (but not `">="`) must always return "R" , and that MIC values starting with `"<"` (but not `"<="`) must always return "S"
#' @param add_intrinsic_resistance *(only useful when using a EUCAST guideline)* a [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 *Klebsiella* species. Determination is based on the [intrinsic_resistant] data set, that itself is based on `r format_eucast_version_nr(3.3)`.
#' @param reference_data a [data.frame] to be used for interpretation, which defaults to the [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 [rsi_translation] data set (same column names and column types). Please note that the `guideline` argument will be ignored when `reference_data` is manually set.
@ -179,7 +179,7 @@
#' example_isolates %>%
#' mutate_if(is.rsi.eligible, as.rsi)
#'
#' # note: from dplyr 1.0.0 on, this will be:
#' # since dplyr 1.0.0, this can also be:
#' # example_isolates %>%
#' # mutate(across(where(is.rsi.eligible), as.rsi))
#' }
@ -189,7 +189,7 @@ as.rsi <- function(x, ...) {
}
#' @rdname as.rsi
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class.
#' @details `NA_rsi_` is a missing value of the new `<rsi>` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @export
NA_rsi_ <- set_clean_class(factor(NA, levels = c("S", "I", "R"), ordered = TRUE),
new_class = c("rsi", "ordered", "factor"))

Binary file not shown.

Binary file not shown.

View File

@ -43,7 +43,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -205,14 +205,12 @@ Content not found. Please use links in the navbar.
<footer><div class="copyright">
<p></p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -416,13 +416,11 @@ END OF TERMS AND CONDITIONS
<footer><div class="copyright">
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -44,7 +44,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -190,7 +190,7 @@
<div class="page-header toc-ignore">
<h1 data-toc-skip>Data sets for download / own use</h1>
<h4 data-toc-skip class="date">08 April 2022</h4>
<h4 data-toc-skip class="date">09 May 2022</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/HEAD/vignettes/datasets.Rmd" class="external-link"><code>vignettes/datasets.Rmd</code></a></small>
<div class="hidden name"><code>datasets.Rmd</code></div>
@ -913,7 +913,7 @@ file</a> (10.2 MB)</li>
<h3 id="source-4">Source<a class="anchor" aria-label="anchor" href="#source-4"></a>
</h3>
<p>This data set contains all defined intrinsic resistance by EUCAST of
all bug-drug combinations, and is based on <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/" class="external-link">EUCAST
all bug-drug combinations, and is based on <a href="https://www.eucast.org/expert_rules_and_expected_phenotypes/" class="external-link">EUCAST
Expert Rules and EUCAST Intrinsic Resistance and Unusual Phenotypes
v3.3</a> (2021).</p>
</div>
@ -1460,14 +1460,12 @@ Breakpoint Tables v11.0</a> (2021).</p>
<footer><div class="copyright">
<p></p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -269,13 +269,11 @@ Antimicrobial Resistance Data. Journal of Statistical Software (accepted for pub
<footer><div class="copyright">
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -47,7 +47,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -195,74 +195,22 @@
<code>AMR</code> (for R) <img src="./logo.svg" align="right"><a class="anchor" aria-label="anchor" href="#amr-for-r-"></a>
</h1></div>
<blockquote>
<p>Update March 2022: All functions in this package are considered to be
stable. Updates to the AMR interpretation rules (such as by EUCAST and
CLSI), the microbial taxonomy, and the antibiotic dosages will all be
updated every 6 to 12 months.</p>
<p>Update March 2022: All functions in this package are considered to be stable. Updates to the AMR interpretation rules (such as by EUCAST and CLSI), the microbial taxonomy, and the antibiotic dosages will all be updated every 6 to 12 months.</p>
</blockquote>
<div class="section level3">
<h3 id="what-is-amr-for-r">What is <code>AMR</code> (for R)?<a class="anchor" aria-label="anchor" href="#what-is-amr-for-r"></a>
</h3>
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org" class="external-link">R package</a> (see <a href="#copyright">Copyright</a>) 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</strong> for clean and
reproducible AMR data analysis, that can therefore empower
epidemiological analyses to continuously enable surveillance and
treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~71,000 distinct
microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~570 antibiotic, antimycotic
and antiviral drugs</strong></a> by name and code (including ATC,
WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about
valid R/SI and MIC values. It supports any data format, including
WHONET/EARS-Net data.</p>
<p>The <code>AMR</code> package is available in
<img src="lang_da.svg" style="height: 11px !important; vertical-align: initial !important;">
Danish,
<img src="lang_nl.svg" style="height: 11px !important; vertical-align: initial !important;">
Dutch,
<img src="lang_en.svg" style="height: 11px !important; vertical-align: initial !important;">
English,
<img src="lang_fr.svg" style="height: 11px !important; vertical-align: initial !important;">
French,
<img src="lang_de.svg" style="height: 11px !important; vertical-align: initial !important;">
German,
<img src="lang_it.svg" style="height: 11px !important; vertical-align: initial !important;">
Italian,
<img src="lang_pt.svg" style="height: 11px !important; vertical-align: initial !important;">
Portuguese,
<img src="lang_ru.svg" style="height: 11px !important; vertical-align: initial !important;">
Russian,
<img src="lang_es.svg" style="height: 11px !important; vertical-align: initial !important;">
Spanish and
<img src="lang_sv.svg" style="height: 11px !important; vertical-align: initial !important;">
Swedish. Antimicrobial drug (group) names and colloquial microorganism
names are provided in these languages.</p>
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell" class="external-link">fully independent
of any other R package</a> and 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</strong>. It was created for both routine data analysis and
academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl" class="external-link">University of Groningen</a>, in collaboration
with non-profit organisations <a href="https://www.certe.nl" class="external-link">Certe
Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a>. This
R package formed the basis of two PhD theses (<a href="https://doi.org/10.33612/diss.177417131" class="external-link">DOI
10.33612/diss.177417131</a> and <a href="https://doi.org/10.33612/diss.192486375" class="external-link">DOI
10.33612/diss.192486375</a>) but is <a href="./news">actively and
durably maintained</a> by two public healthcare organisations in the
Netherlands.</p>
<p><code>AMR</code> is a free, open-source and independent <a href="https://www.r-project.org" class="external-link">R package</a> (see <a href="#copyright">Copyright</a>) 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</strong> for clean and reproducible AMR data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~71,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~570 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, WHONET/EARS-Net, PubChem, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>The <code>AMR</code> package is available in <img src="lang_da.svg" style="height: 11px !important; vertical-align: initial !important;"> Danish, <img src="lang_nl.svg" style="height: 11px !important; vertical-align: initial !important;"> Dutch, <img src="lang_en.svg" style="height: 11px !important; vertical-align: initial !important;"> English, <img src="lang_fr.svg" style="height: 11px !important; vertical-align: initial !important;"> French, <img src="lang_de.svg" style="height: 11px !important; vertical-align: initial !important;"> German, <img src="lang_it.svg" style="height: 11px !important; vertical-align: initial !important;"> Italian, <img src="lang_pt.svg" style="height: 11px !important; vertical-align: initial !important;"> Portuguese, <img src="lang_ru.svg" style="height: 11px !important; vertical-align: initial !important;"> Russian, <img src="lang_es.svg" style="height: 11px !important; vertical-align: initial !important;"> Spanish and <img src="lang_sv.svg" style="height: 11px !important; vertical-align: initial !important;"> Swedish. Antimicrobial drug (group) names and colloquial microorganism names are provided in these languages.</p>
<p>This package is <a href="https://en.wikipedia.org/wiki/Dependency_hell" class="external-link">fully independent of any other R package</a> and 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</strong>. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the <a href="https://www.rug.nl" class="external-link">University of Groningen</a>, in collaboration with non-profit organisations <a href="https://www.certe.nl" class="external-link">Certe Medical Diagnostics and Advice Foundation</a> and <a href="https://www.umcg.nl" class="external-link">University Medical Center Groningen</a>. This R package formed the basis of two PhD theses (<a href="https://doi.org/10.33612/diss.177417131" class="external-link">DOI 10.33612/diss.177417131</a> and <a href="https://doi.org/10.33612/diss.192486375" class="external-link">DOI 10.33612/diss.192486375</a>) but is <a href="./news">actively and durably maintained</a> by two public healthcare organisations in the Netherlands.</p>
<div class="main-content" style="display: inline-block;">
<p>
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a>
<strong>Used in 175 countries</strong><br> Since its first public
release in early 2018, this R package has been used in almost all
countries in the world. Click the map to enlarge and to see the country
names.
<a href="./countries_large.png" target="_blank"><img src="./countries.png" class="countries_map"></a> <strong>Used in 175 countries</strong><br> Since its first public release in early 2018, this R package has been used in almost all countries in the world. Click the map to enlarge and to see the country names.
</p>
</div>
<div class="section level5">
<h5 id="with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side">With <code>AMR</code> (for R), theres always a knowledgeable
microbiologist by your side!<a class="anchor" aria-label="anchor" href="#with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side"></a>
<h5 id="with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side">With <code>AMR</code> (for R), theres always a knowledgeable microbiologist by your side!<a class="anchor" aria-label="anchor" href="#with-amr-for-r-theres-always-a-knowledgeable-microbiologist-by-your-side"></a>
</h5>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># AMR works great with dplyr, but it's not required or neccesary</span>
@ -276,12 +224,7 @@ microbiologist by your side!<a class="anchor" aria-label="anchor" href="#with-am
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html" class="external-link">select</a></span><span class="op">(</span><span class="va">bacteria</span>,
<span class="fu"><a href="reference/antibiotic_class_selectors.html">aminoglycosides</a></span><span class="op">(</span><span class="op">)</span>,
<span class="fu"><a href="reference/antibiotic_class_selectors.html">carbapenems</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<p>With only having defined a row filter on Gram-negative bacteria with
intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code>
and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on
two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and
<code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the
<code>AMR</code> package make sure you get what you meant:</p>
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
<table class="table">
<thead><tr class="header">
<th align="left">bacteria</th>
@ -395,14 +338,9 @@ two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html"
<div class="section level4">
<h4 id="partners">Partners<a class="anchor" aria-label="anchor" href="#partners"></a>
</h4>
<p>The development of this package is part of, related to, or made
possible by:</p>
<p>The development of this package is part of, related to, or made possible by:</p>
<div align="center">
<p><a href="https://www.rug.nl" title="University of Groningen" class="external-link"><img src="./logo_rug.png" class="partner_logo"></a>
<a href="https://www.umcg.nl" title="University Medical Center Groningen" class="external-link"><img src="./logo_umcg.png" class="partner_logo"></a>
<a href="https://www.certe.nl" title="Certe Medical Diagnostics and Advice Foundation" class="external-link"><img src="./logo_certe.png" class="partner_logo"></a>
<a href="https://www.deutschland-nederland.eu" title="EurHealth-1-Health" class="external-link"><img src="./logo_eh1h.png" class="partner_logo"></a>
<a href="https://www.deutschland-nederland.eu" title="INTERREG" class="external-link"><img src="./logo_interreg.png" class="partner_logo"></a></p>
<p><a href="https://www.rug.nl" title="University of Groningen" class="external-link"><img src="./logo_rug.png" class="partner_logo"></a> <a href="https://www.umcg.nl" title="University Medical Center Groningen" class="external-link"><img src="./logo_umcg.png" class="partner_logo"></a> <a href="https://www.certe.nl" title="Certe Medical Diagnostics and Advice Foundation" class="external-link"><img src="./logo_certe.png" class="partner_logo"></a> <a href="https://www.deutschland-nederland.eu" title="EurHealth-1-Health" class="external-link"><img src="./logo_eh1h.png" class="partner_logo"></a> <a href="https://www.deutschland-nederland.eu" title="INTERREG" class="external-link"><img src="./logo_interreg.png" class="partner_logo"></a></p>
</div>
</div>
</div>
@ -411,33 +349,21 @@ possible by:</p>
</h3>
<p>This package can be used for:</p>
<ul>
<li>Reference for the taxonomy of microorganisms, since the package
contains all microbial (sub)species from the <a href="http://www.catalogueoflife.org" class="external-link">Catalogue of Life</a> and <a href="https://lpsn.dsmz.de" class="external-link">List of Prokaryotic names with Standing in
Nomenclature</a> (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Interpreting raw MIC and disk diffusion values, based on the latest
CLSI or EUCAST guidelines (<a href="./reference/as.rsi.html">manual</a>)</li>
<li>Retrieving antimicrobial drug names, doses and forms of
administration from clinical health care records (<a href="./reference/ab_from_text.html">manual</a>)</li>
<li>Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the <a href="http://www.catalogueoflife.org" class="external-link">Catalogue of Life</a> and <a href="https://lpsn.dsmz.de" class="external-link">List of Prokaryotic names with Standing in Nomenclature</a> (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines (<a href="./reference/as.rsi.html">manual</a>)</li>
<li>Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records (<a href="./reference/ab_from_text.html">manual</a>)</li>
<li>Determining first isolates to be used for AMR data analysis (<a href="./reference/first_isolate.html">manual</a>)</li>
<li>Calculating antimicrobial resistance (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Determining multi-drug resistance (MDR) / multi-drug resistant
organisms (MDRO) (<a href="./articles/MDR.html">tutorial</a>)</li>
<li>Calculating (empirical) susceptibility of both mono therapy and
combination therapies (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Predicting future antimicrobial resistance using regression models
(<a href="./articles/resistance_predict.html">tutorial</a>)</li>
<li>Getting properties for any microorganism (like Gram stain, species,
genus or family) (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Getting properties for any antibiotic (like name, code of
EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name) (<a href="./reference/ab_property.html">manual</a>)</li>
<li>Determining multi-drug resistance (MDR) / multi-drug resistant organisms (MDRO) (<a href="./articles/MDR.html">tutorial</a>)</li>
<li>Calculating (empirical) susceptibility of both mono therapy and combination therapies (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Predicting future antimicrobial resistance using regression models (<a href="./articles/resistance_predict.html">tutorial</a>)</li>
<li>Getting properties for any microorganism (like Gram stain, species, genus or family) (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name) (<a href="./reference/ab_property.html">manual</a>)</li>
<li>Plotting antimicrobial resistance (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Applying EUCAST expert rules (<a href="./reference/eucast_rules.html">manual</a>)</li>
<li>Getting SNOMED codes of a microorganism, or getting properties of a
microorganism based on a SNOMED code (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Getting LOINC codes of an antibiotic, or getting properties of an
antibiotic based on a LOINC code (<a href="./reference/ab_property.html">manual</a>)</li>
<li>Machine reading the EUCAST and CLSI guidelines from 2011-2021 to
translate MIC values and disk diffusion diameters to R/SI (<a href="./articles/datasets.html">link</a>)</li>
<li>Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Getting LOINC codes of an antibiotic, or getting properties of an antibiotic based on a LOINC code (<a href="./reference/ab_property.html">manual</a>)</li>
<li>Machine reading the EUCAST and CLSI guidelines from 2011-2021 to translate MIC values and disk diffusion diameters to R/SI (<a href="./articles/datasets.html">link</a>)</li>
<li>Principal component analysis for AMR (<a href="./articles/PCA.html">tutorial</a>)</li>
</ul>
</div>
@ -448,24 +374,17 @@ translate MIC values and disk diffusion diameters to R/SI (<a href="./articles/d
<h4 id="latest-released-version">Latest released version<a class="anchor" aria-label="anchor" href="#latest-released-version"></a>
</h4>
<p><a href="https://cran.r-project.org/package=AMR" class="external-link"><img src="https://www.r-pkg.org/badges/version-ago/AMR" alt="CRAN"></a> <a href="https://cran.r-project.org/package=AMR" class="external-link"><img src="https://cranlogs.r-pkg.org/badges/grand-total/AMR" alt="CRANlogs"></a></p>
<p>This package is available <a href="https://cran.r-project.org/package=AMR" class="external-link">here on the official R
network (CRAN)</a>. Install this package in R from CRAN by using the
command:</p>
<p>This package is available <a href="https://cran.r-project.org/package=AMR" class="external-link">here on the official R network (CRAN)</a>. Install this package in R from CRAN by using the command:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"AMR"</span><span class="op">)</span></code></pre></div>
<p>It will be downloaded and installed automatically. For RStudio, click
on the menu <em>Tools</em> &gt; <em>Install Packages…</em> and then type
in “AMR” and press <kbd>Install</kbd>.</p>
<p><strong>Note:</strong> Not all functions on this website may be
available in this latest release. To use all functions and data sets
mentioned on this website, install the latest development version.</p>
<p>It will be downloaded and installed automatically. For RStudio, click on the menu <em>Tools</em> &gt; <em>Install Packages…</em> and then type in “AMR” and press <kbd>Install</kbd>.</p>
<p><strong>Note:</strong> Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.</p>
</div>
<div class="section level4">
<h4 id="latest-development-version">Latest development version<a class="anchor" aria-label="anchor" href="#latest-development-version"></a>
</h4>
<p><a href="https://codecov.io/gh/msberends/AMR?branch=main" class="external-link"><img src="https://github.com/msberends/AMR/workflows/R-code-check/badge.svg?branch=main" alt="R-code-check"></a> <a href="https://www.codefactor.io/repository/github/msberends/amr" class="external-link"><img src="https://www.codefactor.io/repository/github/msberends/amr/badge" alt="CodeFactor"></a> <a href="https://codecov.io/gh/msberends/AMR?branch=main" class="external-link"><img src="https://codecov.io/gh/msberends/AMR/branch/main/graph/badge.svg" alt="Codecov"></a></p>
<p>The latest and unpublished development version can be installed from
GitHub in two ways:</p>
<p>The latest and unpublished development version can be installed from GitHub in two ways:</p>
<ol style="list-style-type: decimal">
<li>
<p>Manually, using:</p>
@ -474,16 +393,11 @@ GitHub in two ways:</p>
<span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html" class="external-link">install_github</a></span><span class="op">(</span><span class="st">"msberends/AMR"</span><span class="op">)</span></code></pre></div>
</li>
<li>
<p>Automatically, using the <a href="https://ropensci.org/r-universe/" class="external-link">rOpenSci R-universe
platform</a>, by adding <a href="https://msberends.r-universe.dev" class="external-link">our
R-universe address</a> to your list of repositories (repos):</p>
<p>Automatically, using the <a href="https://ropensci.org/r-universe/" class="external-link">rOpenSci R-universe platform</a>, by adding <a href="https://msberends.r-universe.dev" class="external-link">our R-universe address</a> to your list of repositories (repos):</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">options</a></span><span class="op">(</span>repos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"repos"</span><span class="op">)</span>,
msberends <span class="op">=</span> <span class="st">"https://msberends.r-universe.dev"</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<p>After this, you can install and update this <code>AMR</code> package
like any official release (e.g., using
<code>install.packages("AMR")</code> or in RStudio via <em>Tools</em>
&gt; <em>Check for Package Updates…</em>).</p>
<p>After this, you can install and update this <code>AMR</code> package like any official release (e.g., using <code>install.packages("AMR")</code> or in RStudio via <em>Tools</em> &gt; <em>Check for Package Updates…</em>).</p>
</li>
</ol>
<p>You can also download the latest build from our repository: <a href="https://github.com/msberends/AMR/raw/main/data-raw/AMR_latest.tar.gz" class="external-link uri">https://github.com/msberends/AMR/raw/main/data-raw/AMR_latest.tar.gz</a></p>
@ -492,8 +406,7 @@ like any official release (e.g., using
<div class="section level3">
<h3 id="get-started">Get started<a class="anchor" aria-label="anchor" href="#get-started"></a>
</h3>
<p>To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or
click a link in the <a href="https://msberends.github.io/AMR/articles/">How to menu</a>.</p>
<p>To find out how to conduct AMR data analysis, please <a href="./articles/AMR.html">continue reading here to get started</a> or click a link in the <a href="https://msberends.github.io/AMR/articles/">How to menu</a>.</p>
</div>
<div class="section level3">
<h3 id="short-introduction">Short introduction<a class="anchor" aria-label="anchor" href="#short-introduction"></a>
@ -501,181 +414,66 @@ click a link in the <a href="https://msberends.github.io/AMR/articles/">How t
<div class="section level4">
<h4 id="microbial-taxonomic-reference-data">Microbial (taxonomic) reference data<a class="anchor" aria-label="anchor" href="#microbial-taxonomic-reference-data"></a>
</h4>
<p>This package contains the complete taxonomic tree of almost all
~71,000 microorganisms from the authoritative and comprehensive
Catalogue of Life (CoL, <a href="http://www.catalogueoflife.org" class="external-link">www.catalogueoflife.org</a>),
supplemented by data from the List of Prokaryotic names with Standing in
Nomenclature (LPSN, <a href="https://lpsn.dsmz.de" class="external-link">lpsn.dsmz.de</a>).
This supplementation is needed until the <a href="https://github.com/Sp2000/colplus" class="external-link">CoL+ project</a> is finished,
which we await. With <code><a href="reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code> can be
checked which version of the CoL is included in this package.</p>
<p>This package contains the complete taxonomic tree of almost all ~71,000 microorganisms from the authoritative and comprehensive Catalogue of Life (CoL, <a href="http://www.catalogueoflife.org" class="external-link">www.catalogueoflife.org</a>), supplemented by data from the List of Prokaryotic names with Standing in Nomenclature (LPSN, <a href="https://lpsn.dsmz.de" class="external-link">lpsn.dsmz.de</a>). This supplementation is needed until the <a href="https://github.com/Sp2000/colplus" class="external-link">CoL+ project</a> is finished, which we await. With <code><a href="reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code> can be checked which version of the CoL is included in this package.</p>
<p>Read more about which data from the Catalogue of Life <a href="./reference/catalogue_of_life.html">in our manual</a>.</p>
</div>
<div class="section level4">
<h4 id="antimicrobial-reference-data">Antimicrobial reference data<a class="anchor" aria-label="anchor" href="#antimicrobial-reference-data"></a>
</h4>
<p>This package contains <strong>all ~570 antibiotic, antimycotic and
antiviral drugs</strong> and their Anatomical Therapeutic Chemical (ATC)
codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the
World Health Organization Collaborating Centre for Drug Statistics
Methodology (WHOCC, <a href="https://www.whocc.no" class="external-link uri">https://www.whocc.no</a>) and the <a href="https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm" class="external-link">Pharmaceuticals
Community Register of the European Commission</a>.</p>
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial
purposes, unlike any other info from this package. See <a href="https://www.whocc.no/copyright_disclaimer/" class="external-link uri">https://www.whocc.no/copyright_disclaimer/</a>.</strong></p>
<p>This package contains <strong>all ~570 antibiotic, antimycotic and antiviral drugs</strong> and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD, oral and IV) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, <a href="https://www.whocc.no" class="external-link uri">https://www.whocc.no</a>) and the <a href="https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm" class="external-link">Pharmaceuticals Community Register of the European Commission</a>.</p>
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See <a href="https://www.whocc.no/copyright_disclaimer/" class="external-link uri">https://www.whocc.no/copyright_disclaimer/</a>.</strong></p>
<p>Read more about the data from WHOCC <a href="./reference/WHOCC.html">in our manual</a>.</p>
</div>
<div class="section level4">
<h4 id="whonet--ears-net">WHONET / EARS-Net<a class="anchor" aria-label="anchor" href="#whonet--ears-net"></a>
</h4>
<p>We support WHONET and EARS-Net data. Exported files from WHONET can
be imported into R and can be analysed easily using this package. For
education purposes, we created an <a href="./reference/WHONET.html">example data set <code>WHONET</code></a>
with the exact same structure as a WHONET export file. Furthermore, this
package also contains a <a href="./reference/antibiotics.html">data set
antibiotics</a> with all EARS-Net antibiotic abbreviations, and knows
almost all WHONET abbreviations for microorganisms. When using WHONET
data as input for analysis, all input parameters will be set
automatically.</p>
<p>Read our tutorial about <a href="./articles/WHONET.html">how to work
with WHONET data here</a>.</p>
<p>We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an <a href="./reference/WHONET.html">example data set <code>WHONET</code></a> with the exact same structure as a WHONET export file. Furthermore, this package also contains a <a href="./reference/antibiotics.html">data set antibiotics</a> with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.</p>
<p>Read our tutorial about <a href="./articles/WHONET.html">how to work with WHONET data here</a>.</p>
</div>
<div class="section level4">
<h4 id="overview-of-functions">Overview of functions<a class="anchor" aria-label="anchor" href="#overview-of-functions"></a>
</h4>
<p>The <code>AMR</code> package basically does four important
things:</p>
<p>The <code>AMR</code> package basically does four important things:</p>
<ol style="list-style-type: decimal">
<li>
<p>It <strong>cleanses existing data</strong> by providing new
<em>classes</em> for microoganisms, antibiotics and antimicrobial
results (both S/I/R and MIC). By installing this package, you teach R
everything about microbiology that is needed for analysis. These
functions all use intelligent rules to guess results that you would
expect:</p>
<p>It <strong>cleanses existing data</strong> by providing new <em>classes</em> for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use intelligent rules to guess results that you would expect:</p>
<ul>
<li>Use <code><a href="reference/as.mo.html">as.mo()</a></code> to get a microbial ID. The IDs are human
readable for the trained eye - the ID of <em>Klebsiella pneumoniae</em>
is “B_KLBSL_PNMN” (B stands for Bacteria) and the ID of <em>S.
aureus</em> is “B_STPHY_AURS”. The function takes almost any text as
input that looks like the name or code of a microorganism like “E.
coli”, “esco” or “esccol” and tries to find expected results using
intelligent rules combined with the included Catalogue of Life data set.
It only takes milliseconds to find results, please see our <a href="./articles/benchmarks.html">benchmarks</a>. Moreover, it can group
<em>Staphylococci</em> into coagulase negative and positive (CoNS and
CoPS, see <a href="./reference/as.mo.html#source">source</a>) and can
categorise <em>Streptococci</em> into Lancefield groups (like
beta-haemolytic <em>Streptococcus</em> Group B, <a href="./reference/as.mo.html#source">source</a>).</li>
<li>Use <code><a href="reference/as.ab.html">as.ab()</a></code> to get an antibiotic ID. Like microbial
IDs, these IDs are also human readable based on those used by EARS-Net.
For example, the ID of amoxicillin is <code>AMX</code> and the ID of
gentamicin is <code>GEN</code>. The <code><a href="reference/as.ab.html">as.ab()</a></code> function also
uses intelligent rules to find results like accepting misspelling, trade
names and abbrevations used in many laboratory systems. For instance,
the values “Furabid”, “Furadantin”, “nitro” all return the ID of
Nitrofurantoine. To accomplish this, the package contains a database
with most LIS codes, official names, trade names, ATC codes, defined
daily doses (DDD) and drug categories of antibiotics.</li>
<li>Use <code><a href="reference/as.rsi.html">as.rsi()</a></code> to get antibiotic interpretations based on
raw MIC values (in mg/L) or disk diffusion values (in mm), or transform
existing values to valid antimicrobial results. It produces just S, I or
R based on your input and warns about invalid values. Even values like
&lt;=0.002; S” (combined MIC/RSI) will result in “S”.</li>
<li>Use <code><a href="reference/as.mic.html">as.mic()</a></code> to cleanse your MIC values. It produces a
so-called factor (called <em>ordinal</em> in SPSS) with valid MIC values
as levels. A value like “&lt;=0.002; S” (combined MIC/RSI) will result
in “&lt;=0.002”.</li>
<li>Use <code><a href="reference/as.mo.html">as.mo()</a></code> to get a microbial ID. The IDs are human readable for the trained eye - the ID of <em>Klebsiella pneumoniae</em> is “B_KLBSL_PNMN” (B stands for Bacteria) and the ID of <em>S. aureus</em> is “B_STPHY_AURS”. The function takes almost any text as input that looks like the name or code of a microorganism like “E. coli”, “esco” or “esccol” and tries to find expected results using intelligent rules combined with the included Catalogue of Life data set. It only takes milliseconds to find results, please see our <a href="./articles/benchmarks.html">benchmarks</a>. Moreover, it can group <em>Staphylococci</em> into coagulase negative and positive (CoNS and CoPS, see <a href="./reference/as.mo.html#source">source</a>) and can categorise <em>Streptococci</em> into Lancefield groups (like beta-haemolytic <em>Streptococcus</em> Group B, <a href="./reference/as.mo.html#source">source</a>).</li>
<li>Use <code><a href="reference/as.ab.html">as.ab()</a></code> to get an antibiotic ID. Like microbial IDs, these IDs are also human readable based on those used by EARS-Net. For example, the ID of amoxicillin is <code>AMX</code> and the ID of gentamicin is <code>GEN</code>. The <code><a href="reference/as.ab.html">as.ab()</a></code> function also uses intelligent rules to find results like accepting misspelling, trade names and abbrevations used in many laboratory systems. For instance, the values “Furabid”, “Furadantin”, “nitro” all return the ID of Nitrofurantoine. To accomplish this, the package contains a database with most LIS codes, official names, trade names, ATC codes, defined daily doses (DDD) and drug categories of antibiotics.</li>
<li>Use <code><a href="reference/as.rsi.html">as.rsi()</a></code> to get antibiotic interpretations based on raw MIC values (in mg/L) or disk diffusion values (in mm), or transform existing values to valid antimicrobial results. It produces just S, I or R based on your input and warns about invalid values. Even values like “&lt;=0.002; S” (combined MIC/RSI) will result in “S”.</li>
<li>Use <code><a href="reference/as.mic.html">as.mic()</a></code> to cleanse your MIC values. It produces a so-called factor (called <em>ordinal</em> in SPSS) with valid MIC values as levels. A value like “&lt;=0.002; S” (combined MIC/RSI) will result in “&lt;=0.002”.</li>
</ul>
</li>
<li>
<p>It <strong>enhances existing data</strong> and <strong>adds new
data</strong> from data sets included in this package.</p>
<p>It <strong>enhances existing data</strong> and <strong>adds new data</strong> from data sets included in this package.</p>
<ul>
<li>Use <code><a href="reference/eucast_rules.html">eucast_rules()</a></code> to apply <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/" class="external-link">EUCAST
expert rules to isolates</a> (not the translation from MIC to R/SI
values, use <code><a href="reference/as.rsi.html">as.rsi()</a></code> for that).</li>
<li>Use <code><a href="reference/first_isolate.html">first_isolate()</a></code> to identify the first isolates of
every patient <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">using
guidelines from the CLSI</a> (Clinical and Laboratory Standards
Institute).
<li>Use <code><a href="reference/eucast_rules.html">eucast_rules()</a></code> to apply <a href="https://www.eucast.org/expert_rules_and_intrinsic_resistance/" class="external-link">EUCAST expert rules to isolates</a> (not the translation from MIC to R/SI values, use <code><a href="reference/as.rsi.html">as.rsi()</a></code> for that).</li>
<li>Use <code><a href="reference/first_isolate.html">first_isolate()</a></code> to identify the first isolates of every patient <a href="https://clsi.org/standards/products/microbiology/documents/m39/" class="external-link">using guidelines from the CLSI</a> (Clinical and Laboratory Standards Institute).
<ul>
<li>You can also identify first <em>weighted</em> isolates of every
patient, an adjusted version of the CLSI guideline. This takes into
account key antibiotics of every strain and compares them.</li>
<li>You can also identify first <em>weighted</em> isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.</li>
</ul>
</li>
<li>Use <code><a href="reference/mdro.html">mdro()</a></code> to determine which micro-organisms are
multi-drug resistant organisms (MDRO). It supports a variety of
international guidelines, such as the MDR-paper by Magiorakos <em>et
al.</em> (2012, <a href="https://www.ncbi.nlm.nih.gov/pubmed/?term=21793988" class="external-link">PMID
21793988</a>), the exceptional phenotype definitions of EUCAST and the
WHO guideline on multi-drug resistant TB. It also supports the national
guidelines of the Netherlands and Germany.</li>
<li>The <a href="./reference/microorganisms.html">data set
microorganisms</a> contains the complete taxonomic tree of ~70,000
microorganisms. Furthermore, some colloquial names and all Gram stains
are available, which enables resistance analysis of e.g. different
antibiotics per Gram stain. The package also contains functions to look
up values in this data set like <code><a href="reference/mo_property.html">mo_genus()</a></code>,
<code><a href="reference/mo_property.html">mo_family()</a></code>, <code><a href="reference/mo_property.html">mo_gramstain()</a></code> or even
<code><a href="reference/mo_property.html">mo_phylum()</a></code>. Use <code><a href="reference/mo_property.html">mo_snomed()</a></code> to look up any
SNOMED CT code associated with a microorganism. As all these function
use <code><a href="reference/as.mo.html">as.mo()</a></code> internally, they also use the same intelligent
rules for determination. For example, <code>mo_genus("MRSA")</code> and
<code>mo_genus("S. aureus")</code> will both return
<code>"Staphylococcus"</code>. They also come with support for German,
Danish, Dutch, Spanish, Italian, French and Portuguese. These functions
can be used to add new variables to your data.</li>
<li>The <a href="./reference/antibiotics.html">data set antibiotics</a>
contains ~450 antimicrobial drugs with their EARS-Net code, ATC code,
PubChem compound ID, LOINC code, official name, common LIS codes and
DDDs of both oral and parenteral administration. It also contains all
(thousands of) trade names found in PubChem. Use functions like
<code><a href="reference/ab_property.html">ab_name()</a></code>, <code><a href="reference/ab_property.html">ab_group()</a></code>, <code><a href="reference/ab_property.html">ab_atc()</a></code>,
<code><a href="reference/ab_property.html">ab_loinc()</a></code> and <code><a href="reference/ab_property.html">ab_tradenames()</a></code> to look up
values. The <code>ab_*</code> functions use <code><a href="reference/as.ab.html">as.ab()</a></code>
internally so they support the same intelligent rules to guess the most
probable result. For example, <code>ab_name("Fluclox")</code>,
<code>ab_name("Floxapen")</code> and <code>ab_name("J01CF05")</code>
will all return <code>"Flucloxacillin"</code>. These functions can again
be used to add new variables to your data.</li>
<li>Use <code><a href="reference/mdro.html">mdro()</a></code> to determine which micro-organisms are multi-drug resistant organisms (MDRO). It supports a variety of international guidelines, such as the MDR-paper by Magiorakos <em>et al.</em> (2012, <a href="https://www.ncbi.nlm.nih.gov/pubmed/?term=21793988" class="external-link">PMID 21793988</a>), the exceptional phenotype definitions of EUCAST and the WHO guideline on multi-drug resistant TB. It also supports the national guidelines of the Netherlands and Germany.</li>
<li>The <a href="./reference/microorganisms.html">data set microorganisms</a> contains the complete taxonomic tree of ~70,000 microorganisms. Furthermore, some colloquial names and all Gram stains are available, which enables resistance analysis of e.g. different antibiotics per Gram stain. The package also contains functions to look up values in this data set like <code><a href="reference/mo_property.html">mo_genus()</a></code>, <code><a href="reference/mo_property.html">mo_family()</a></code>, <code><a href="reference/mo_property.html">mo_gramstain()</a></code> or even <code><a href="reference/mo_property.html">mo_phylum()</a></code>. Use <code><a href="reference/mo_property.html">mo_snomed()</a></code> to look up any SNOMED CT code associated with a microorganism. As all these function use <code><a href="reference/as.mo.html">as.mo()</a></code> internally, they also use the same intelligent rules for determination. For example, <code>mo_genus("MRSA")</code> and <code>mo_genus("S. aureus")</code> will both return <code>"Staphylococcus"</code>. They also come with support for German, Danish, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.</li>
<li>The <a href="./reference/antibiotics.html">data set antibiotics</a> contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, LOINC code, official name, common LIS codes and DDDs of both oral and parenteral administration. It also contains all (thousands of) trade names found in PubChem. Use functions like <code><a href="reference/ab_property.html">ab_name()</a></code>, <code><a href="reference/ab_property.html">ab_group()</a></code>, <code><a href="reference/ab_property.html">ab_atc()</a></code>, <code><a href="reference/ab_property.html">ab_loinc()</a></code> and <code><a href="reference/ab_property.html">ab_tradenames()</a></code> to look up values. The <code>ab_*</code> functions use <code><a href="reference/as.ab.html">as.ab()</a></code> internally so they support the same intelligent rules to guess the most probable result. For example, <code>ab_name("Fluclox")</code>, <code>ab_name("Floxapen")</code> and <code>ab_name("J01CF05")</code> will all return <code>"Flucloxacillin"</code>. These functions can again be used to add new variables to your data.</li>
</ul>
</li>
<li>
<p>It <strong>analyses the data</strong> with convenient functions
that use well-known methods.</p>
<p>It <strong>analyses the data</strong> with convenient functions that use well-known methods.</p>
<ul>
<li>Calculate the microbial susceptibility or resistance (and even
co-resistance) with the <code><a href="reference/proportion.html">susceptibility()</a></code> and
<code><a href="reference/proportion.html">resistance()</a></code> functions, or be even more specific with the
<code><a href="reference/proportion.html">proportion_R()</a></code>, <code><a href="reference/proportion.html">proportion_IR()</a></code>,
<code><a href="reference/proportion.html">proportion_I()</a></code>, <code><a href="reference/proportion.html">proportion_SI()</a></code> and
<code><a href="reference/proportion.html">proportion_S()</a></code> functions. Similarly, the <em>number</em> of
isolates can be determined with the <code><a href="reference/count.html">count_resistant()</a></code>,
<code><a href="reference/count.html">count_susceptible()</a></code> and <code><a href="reference/count.html">count_all()</a></code> functions.
All these functions can be used with the <code>dplyr</code> package
(e.g. in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise()</a></code>)</li>
<li>Plot AMR results with <code><a href="reference/ggplot_rsi.html">geom_rsi()</a></code>, a function made for
the <code>ggplot2</code> package</li>
<li>Predict antimicrobial resistance for the nextcoming years using
logistic regression models with the <code><a href="reference/resistance_predict.html">resistance_predict()</a></code>
function</li>
<li>Calculate the microbial susceptibility or resistance (and even co-resistance) with the <code><a href="reference/proportion.html">susceptibility()</a></code> and <code><a href="reference/proportion.html">resistance()</a></code> functions, or be even more specific with the <code><a href="reference/proportion.html">proportion_R()</a></code>, <code><a href="reference/proportion.html">proportion_IR()</a></code>, <code><a href="reference/proportion.html">proportion_I()</a></code>, <code><a href="reference/proportion.html">proportion_SI()</a></code> and <code><a href="reference/proportion.html">proportion_S()</a></code> functions. Similarly, the <em>number</em> of isolates can be determined with the <code><a href="reference/count.html">count_resistant()</a></code>, <code><a href="reference/count.html">count_susceptible()</a></code> and <code><a href="reference/count.html">count_all()</a></code> functions. All these functions can be used with the <code>dplyr</code> package (e.g. in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/summarise.html" class="external-link">summarise()</a></code>)</li>
<li>Plot AMR results with <code><a href="reference/ggplot_rsi.html">geom_rsi()</a></code>, a function made for the <code>ggplot2</code> package</li>
<li>Predict antimicrobial resistance for the nextcoming years using logistic regression models with the <code><a href="reference/resistance_predict.html">resistance_predict()</a></code> function</li>
</ul>
</li>
<li>
<p>It <strong>teaches the user</strong> how to use all the above
actions.</p>
<p>It <strong>teaches the user</strong> how to use all the above actions.</p>
<ul>
<li>Aside from this website with many tutorials, the package itself
contains extensive help pages with many examples for all functions.</li>
<li>Aside from this website with many tutorials, the package itself contains extensive help pages with many examples for all functions.</li>
<li>The package also contains example data sets:
<ul>
<li>The <a href="./reference/example_isolates.html"><code>example_isolates</code>
data set</a>. This data set contains 2,000 microbial isolates with their
full antibiograms. It reflects reality and can be used to practice AMR
data analysis.</li>
<li>The <a href="./reference/WHONET.html"><code>WHONET</code> data
set</a>. This data set only contains fake data, but with the exact same
structure as files exported by WHONET. Read more about WHONET <a href="./articles/WHONET.html">on its tutorial page</a>.</li>
<li>The <a href="./reference/example_isolates.html"><code>example_isolates</code> data set</a>. This data set contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR data analysis.</li>
<li>The <a href="./reference/WHONET.html"><code>WHONET</code> data set</a>. This data set only contains fake data, but with the exact same structure as files exported by WHONET. Read more about WHONET <a href="./articles/WHONET.html">on its tutorial page</a>.</li>
</ul>
</li>
</ul>
@ -686,9 +484,7 @@ structure as files exported by WHONET. Read more about WHONET <a href="./article
<div class="section level3">
<h3 id="copyright">Copyright<a class="anchor" aria-label="anchor" href="#copyright"></a>
</h3>
<p>This R package is free, open-source software and licensed under the
<a href="./LICENSE-text.html">GNU General Public License v2.0
(GPL-2)</a>. In a nutshell, this means that this package:</p>
<p>This R package is free, open-source software and licensed under the <a href="./LICENSE-text.html">GNU General Public License v2.0 (GPL-2)</a>. In a nutshell, this means that this package:</p>
<ul>
<li><p>May be used for commercial purposes</p></li>
<li><p>May be used for private purposes</p></li>
@ -696,18 +492,15 @@ structure as files exported by WHONET. Read more about WHONET <a href="./article
<li>
<p>May be modified, although:</p>
<ul>
<li>Modifications <strong>must</strong> be released under the same
license when distributing the package</li>
<li>Modifications <strong>must</strong> be released under the same license when distributing the package</li>
<li>Changes made to the code <strong>must</strong> be documented</li>
</ul>
</li>
<li>
<p>May be distributed, although:</p>
<ul>
<li>Source code <strong>must</strong> be made available when the package
is distributed</li>
<li>A copy of the license and copyright notice <strong>must</strong> be
included with the package.</li>
<li>Source code <strong>must</strong> be made available when the package is distributed</li>
<li>A copy of the license and copyright notice <strong>must</strong> be included with the package.</li>
</ul>
</li>
<li><p>Comes with a LIMITATION of liability</p></li>
@ -763,14 +556,12 @@ included with the package.</li>
<footer><div class="copyright">
<p></p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer>

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9002</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -434,7 +434,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>stable</s
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -225,7 +225,7 @@
<dt>ab</dt>
<dd><p>any (vector of) text that can be coerced to a valid antimicrobial code with <code><a href="as.ab.html">as.ab()</a></code></p></dd>
<dt>guideline</dt>
<dd><p>defaults to the latest included EUCAST guideline, see <em>Details</em> for all options</p></dd>
<dd><p>defaults to the latest included EUCAST guideline, supports EUCAST (2011-2021) and CLSI (2010-2021), see <em>Details</em></p></dd>
<dt>uti</dt>
<dd><p>(Urinary Tract Infection) A vector with <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a>s (<code>TRUE</code> or <code>FALSE</code>) to specify whether a UTI specific interpretation from the guideline should be chosen. For using <code>as.rsi()</code> on a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, this can also be a column containing <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a>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 <em>Examples</em>.</p></dd>
<dt>conserve_capped_values</dt>
@ -289,7 +289,7 @@
<p>The function <code>is.rsi.eligible()</code> returns <code>TRUE</code> when a columns contains at most 5% invalid antimicrobial interpretations (not S and/or I and/or R), and <code>FALSE</code> otherwise. The threshold of 5% can be set with the <code>threshold</code> argument. If the input is a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, it iterates over all columns and returns a <a href="https://rdrr.io/r/base/logical.html" class="external-link">logical</a> vector.</p>
</div>
<p><code>NA_rsi_</code> is a missing value of the new <code>&lt;rsi&gt;</code> class.</p>
<p><code>NA_rsi_</code> is a missing value of the new <code>&lt;rsi&gt;</code> class, analogous to e.g. base <span style="R">R</span>'s <code><a href="https://rdrr.io/r/base/NA.html" class="external-link">NA_character_</a></code>.</p>
</div>
<div id="interpretation-of-r-and-s-i">
<h2>Interpretation of R and S/I</h2>
@ -334,7 +334,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>stable</s
<span class="co"># \donttest{</span>
<span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="st"><a href="https://docs.ropensci.org/skimr/" class="external-link">"skimr"</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span>
<span class="co"># class &lt;rsi&gt; supported in skim() too:</span>
<span class="fu">skim</span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span>
<span class="fu"><a href="https://docs.ropensci.org/skimr/reference/skim.html" class="external-link">skim</a></span><span class="op">(</span><span class="va">example_isolates</span><span class="op">)</span>
<span class="op">}</span>
<span class="co"># }</span>
<span class="co"># For INTERPRETING disk diffusion and MIC values -----------------------</span>
@ -408,7 +408,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>stable</s
<span class="va">example_isolates</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html" class="external-link">mutate_if</a></span><span class="op">(</span><span class="va">is.rsi.eligible</span>, <span class="va">as.rsi</span><span class="op">)</span>
<span class="co"># note: from dplyr 1.0.0 on, this will be: </span>
<span class="co"># since dplyr 1.0.0, this can also be: </span>
<span class="co"># example_isolates %&gt;%</span>
<span class="co"># mutate(across(where(is.rsi.eligible), as.rsi))</span>
<span class="op">}</span>
@ -427,7 +427,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>stable</s
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9002</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -180,7 +180,7 @@
<dd><p>a numeric vector; ignored if <code>x</code> is a matrix. If
<code>x</code> is a factor, <code>y</code> should be a factor of the same length.</p></dd>
<dt>p</dt>
<dd><p>a vector of probabilities of the same length of <code>x</code>.
<dd><p>a vector of probabilities of the same length as <code>x</code>.
An error is given if any entry of <code>p</code> is negative.</p></dd>
<dt>rescale.p</dt>
<dd><p>a logical scalar; if TRUE then <code>p</code> is rescaled
@ -327,7 +327,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>questioni
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -200,7 +200,7 @@
</td>
<td><p>Interpret MIC and Disk Values, or Clean Raw R/SI Data</p></td>
</tr><tr><td>
<p><code><a href="as.mic.html">as.mic()</a></code> <code><a href="as.mic.html">NA_mic_</a></code> <code><a href="as.mic.html">is.mic()</a></code> </p>
<p><code><a href="as.mic.html">as.mic()</a></code> <code><a href="as.mic.html">NA_mic_</a></code> <code><a href="as.mic.html">is.mic()</a></code> <code><a href="as.mic.html">droplevels(<i>&lt;mic&gt;</i>)</a></code> </p>
</td>
<td><p>Transform Input to Minimum Inhibitory Concentrations (MIC)</p></td>
</tr><tr><td>
@ -416,7 +416,7 @@
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9002</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -214,7 +214,7 @@
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9002</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -247,7 +247,7 @@ Ordered <a href="https://rdrr.io/r/base/factor.html" class="external-link">facto
<li><p><code>guideline = "TB"</code></p>
<p>The international guideline for multi-drug resistant tuberculosis - World Health Organization "Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis" (<a href="https://www.who.int/publications/i/item/9789241548809" class="external-link">link</a>)</p></li>
<li><p><code>guideline = "MRGN"</code></p>
<p>The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7; doi: <a href="https://doi.org/10.1186/s13756-015-0047-6" class="external-link">10.1186/s13756-015-0047-6</a></p></li>
<p>The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7; <a href="https://doi.org/10.1186/s13756-015-0047-6" class="external-link">doi:10.1186/s13756-015-0047-6</a></p></li>
<li><p><code>guideline = "BRMO"</code></p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu "WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) (ZKH)" (<a href="https://www.rivm.nl/wip-richtlijn-brmo-bijzonder-resistente-micro-organismen-zkh" class="external-link">link</a>)</p></li>
</ul><p>Please suggest your own (country-specific) guidelines by letting us know: <a href="https://github.com/msberends/AMR/issues/new" class="external-link">https://github.com/msberends/AMR/issues/new</a>.</p>
@ -356,7 +356,7 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9002</span>
</span>
</div>
@ -30,7 +30,7 @@
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -295,12 +295,12 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<h2>Source</h2>
<ol><li><p>Becker K <em>et al.</em> <strong>Coagulase-Negative Staphylococci</strong>. 2014. Clin Microbiol Rev. 27(4): 870-926; doi: <a href="https://doi.org/10.1128/CMR.00109-13" class="external-link">10.1128/CMR.00109-13</a></p></li>
<li><p>Becker K <em>et al.</em> <strong>Implications of identifying the recently defined members of the <em>S. aureus</em> complex, <em>S. argenteus</em> and <em>S. schweitzeri</em>: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).</strong> 2019. Clin Microbiol Infect; doi: <a href="https://doi.org/10.1016/j.cmi.2019.02.028" class="external-link">10.1016/j.cmi.2019.02.028</a></p></li>
<li><p>Becker K <em>et al.</em> <strong>Emergence of coagulase-negative staphylococci</strong> 2020. Expert Rev Anti Infect Ther. 18(4):349-366; doi: <a href="https://doi.org/10.1080/14787210.2020.1730813" class="external-link">10.1080/14787210.2020.1730813</a></p></li>
<li><p>Lancefield RC <strong>A serological differentiation of human and other groups of hemolytic streptococci</strong>. 1933. J Exp Med. 57(4): 571-95; doi: <a href="https://doi.org/10.1084/jem.57.4.571" class="external-link">10.1084/jem.57.4.571</a></p></li>
<ol><li><p>Becker K <em>et al.</em> <strong>Coagulase-Negative Staphylococci</strong>. 2014. Clin Microbiol Rev. 27(4): 870-926; <a href="https://doi.org/10.1128/CMR.00109-13" class="external-link">doi:10.1128/CMR.00109-13</a></p></li>
<li><p>Becker K <em>et al.</em> <strong>Implications of identifying the recently defined members of the <em>S. aureus</em> complex, <em>S. argenteus</em> and <em>S. schweitzeri</em>: A position paper of members of the ESCMID Study Group for staphylococci and Staphylococcal Diseases (ESGS).</strong> 2019. Clin Microbiol Infect; <a href="https://doi.org/10.1016/j.cmi.2019.02.028" class="external-link">doi:10.1016/j.cmi.2019.02.028</a></p></li>
<li><p>Becker K <em>et al.</em> <strong>Emergence of coagulase-negative staphylococci</strong> 2020. Expert Rev Anti Infect Ther. 18(4):349-366; <a href="https://doi.org/10.1080/14787210.2020.1730813" class="external-link">doi:10.1080/14787210.2020.1730813</a></p></li>
<li><p>Lancefield RC <strong>A serological differentiation of human and other groups of hemolytic streptococci</strong>. 1933. J Exp Med. 57(4): 571-95; <a href="https://doi.org/10.1084/jem.57.4.571" class="external-link">doi:10.1084/jem.57.4.571</a></p></li>
<li><p>Catalogue of Life: 2019 Annual Checklist, <a href="http://www.catalogueoflife.org" class="external-link">http://www.catalogueoflife.org</a></p></li>
<li><p>List of Prokaryotic names with Standing in Nomenclature (5 October 2021), doi: <a href="https://doi.org/10.1099/ijsem.0.004332" class="external-link">10.1099/ijsem.0.004332</a></p></li>
<li><p>List of Prokaryotic names with Standing in Nomenclature (5 October 2021), <a href="https://doi.org/10.1099/ijsem.0.004332" class="external-link">doi:10.1099/ijsem.0.004332</a></p></li>
<li><p>US Edition of SNOMED CT from 1 September 2020, retrieved from the Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS), OID 2.16.840.1.114222.4.11.1009, version 12; url: <a href="https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009" class="external-link">https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.1009</a></p></li>
</ol></div>
<div id="reference-data-publicly-available">
@ -437,7 +437,7 @@ This package contains the complete taxonomic tree of almost all microorganisms (
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -18,7 +18,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9003</span>
</span>
</div>
@ -31,7 +31,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa fa-question-circle"></span>
How to
@ -175,15 +175,15 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>path</dt>
<dd><p>location of your reference file, see <em>Details</em>. Can be <code>""</code>, <code>NULL</code> or <code>FALSE</code> to delete the reference file.</p></dd>
<dd><p>location of your reference file, this can be any text file (comma-, tab- or pipe-separated) or an Excel file (see <em>Details</em>). Can also be <code>""</code>, <code>NULL</code> or <code>FALSE</code> to delete the reference file.</p></dd>
<dt>destination</dt>
<dd><p>destination of the compressed data file, default to the user's home directory.</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an <span style="R">R</span> object file (extension '.rds'). To use an Excel file, you will need to have the <code>readxl</code> package installed.</p>
<p><code>set_mo_source()</code> will check the file for validity: it must be a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, must have a column named <code>"mo"</code> which contains values from <code><a href="microorganisms.html">microorganisms$mo</a></code> and must have a reference column with your own defined values. If all tests pass, <code>set_mo_source()</code> will read the file into <span style="R">R</span> and will ask to export it to <code>"~/mo_source.rds"</code>. The CRAN policy disallows packages to write to the file system, although '<em>exceptions may be allowed in interactive sessions if the package obtains confirmation from the user</em>'. For this reason, this function only works in interactive sessions so that the user can <strong>specifically confirm and allow</strong> that this file will be created. The destination of this file can be set with the <code>destination</code> argument and defaults to the user's home directory. It can also be set as an <span style="R">R</span> option, using <code>options(AMR_mo_source = "my/location/file.rds")</code>.</p>
<p>The created compressed data file <code>"mo_source.rds"</code> will be used at default for MO determination (function <code><a href="as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions like <code><a href="mo_property.html">mo_genus()</a></code> and <code><a href="mo_property.html">mo_gramstain()</a></code>). The location and timestamp of the original file will be saved as an attribute to the compressed data file.</p>
<p><code>set_mo_source()</code> will check the file for validity: it must be a <a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a>, must have a column named <code>"mo"</code> which contains values from <code><a href="microorganisms.html">microorganisms$mo</a></code> or <code><a href="microorganisms.html">microorganisms$fullname</a></code> and must have a reference column with your own defined values. If all tests pass, <code>set_mo_source()</code> will read the file into <span style="R">R</span> and will ask to export it to <code>"~/mo_source.rds"</code>. The CRAN policy disallows packages to write to the file system, although '<em>exceptions may be allowed in interactive sessions if the package obtains confirmation from the user</em>'. For this reason, this function only works in interactive sessions so that the user can <strong>specifically confirm and allow</strong> that this file will be created. The destination of this file can be set with the <code>destination</code> argument and defaults to the user's home directory. It can also be set as an <span style="R">R</span> option, using <code>options(AMR_mo_source = "my/location/file.rds")</code>.</p>
<p>The created compressed data file <code>"mo_source.rds"</code> will be used at default for MO determination (function <code><a href="as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions like <code><a href="mo_property.html">mo_genus()</a></code> and <code><a href="mo_property.html">mo_gramstain()</a></code>). The location and timestamp of the original file will be saved as an <a href="https://rdrr.io/r/base/attributes.html" class="external-link">attribute</a> to the compressed data file.</p>
<p>The function <code>get_mo_source()</code> will return the data set by reading <code>"mo_source.rds"</code> with <code><a href="https://rdrr.io/r/base/readRDS.html" class="external-link">readRDS()</a></code>. If the original file has changed (by checking the location and timestamp of the original file), it will call <code>set_mo_source()</code> to update the data file automatically if used in an interactive session.</p>
<p>Reading an Excel file (<code>.xlsx</code>) with only one row has a size of 8-9 kB. The compressed file created with <code>set_mo_source()</code> will then have a size of 0.1 kB and can be read by <code>get_mo_source()</code> in only a couple of microseconds (millionths of a second).</p>
</div>
@ -192,12 +192,12 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<p>Imagine this data on a sheet of an Excel file (mo codes were looked up in the <a href="microorganisms.html">microorganisms</a> data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:</p><div class="sourceCode"><pre><code> | A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
4 | | |
<p>Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:</p><div class="sourceCode"><pre><code> | A | B |
--|--------------------|-----------------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | Escherichia coli |
3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
4 | | |
</code></pre></div>
<p>We save it as <code>"home/me/ourcodes.xlsx"</code>. Now we have to set it as a source:</p><div class="sourceCode"><pre><code><span class="fu"><a href="../reference/mo_source.html">set_mo_source</a></span><span class="op">(</span><span class="st">"home/me/ourcodes.xlsx"</span><span class="op">)</span>
@ -220,13 +220,13 @@ This is the fastest way to have your organisation (or analysis) specific codes p
<span class="co">#&gt; Class &lt;mo&gt;</span>
<span class="co">#&gt; [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI</span></code></pre></div>
<p>If we edit the Excel file by, let's say, adding row 4 like this:</p><div class="sourceCode"><pre><code> | A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
4 | lab_Staph_aureus | B_STPHY_AURS |
5 | | |
<p>If we edit the Excel file by, let's say, adding row 4 like this:</p><div class="sourceCode"><pre><code> | A | B |
--|--------------------|-----------------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | Escherichia coli |
3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
4 | lab_Staph_aureus | Staphylococcus aureus |
5 | | |
</code></pre></div>
<p>...any new usage of an MO function in this package will update your data file:</p><div class="sourceCode"><pre><code><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span><span class="op">(</span><span class="st">"lab_mo_ecoli"</span><span class="op">)</span>
@ -271,7 +271,7 @@ The <a href="lifecycle.html">lifecycle</a> of this function is <strong>stable</s
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -17,7 +17,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9001</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">1.8.1.9004</span>
</span>
</div>
@ -168,13 +168,11 @@
<footer><div class="copyright">
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein,
Erwin E. A. Hassing.</p>
<p></p><p>Developed by Matthijs S. Berends, Christian F. Luz, Dennis Souverein, Erwin E. A. Hassing.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a>
2.0.2.</p>
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.3.</p>
</div>
</footer></div>

View File

@ -33,7 +33,9 @@ expect_true(is.mic(as.mic(8)))
expect_equal(as.double(as.mic(">=32")), 32)
expect_equal(as.numeric(as.mic(">=32")), 32)
expect_equal(as.integer(as.mic(">=32")), 32)
expect_equal(as.integer(as.mic(">=32")), # should be factor level, not the MIC
as.integer(factor(as.character(">=32"),
levels = levels(as.mic(">=32")))))
expect_equal(suppressWarnings(as.logical(as.mic("INVALID VALUE"))), NA)
# all levels should be valid MICs
@ -42,7 +44,8 @@ expect_inherits(x[1], "mic")
expect_inherits(x[[1]], "mic")
expect_inherits(c(x[1], x[9]), "mic")
expect_inherits(unique(x[1], x[9]), "mic")
expect_inherits(droplevels(c(x[1], x[9])), "mic")
expect_inherits(droplevels(c(x[1], x[9]), as.mic = TRUE), "factor")
expect_inherits(droplevels(c(x[1], x[9]), as.mic = TRUE), "mic")
x[2] <- 32
expect_inherits(x, "mic")
expect_warning(as.mic("INVALID VALUE"))

View File

@ -6,21 +6,30 @@
\alias{mic}
\alias{NA_mic_}
\alias{is.mic}
\alias{droplevels.mic}
\title{Transform Input to Minimum Inhibitory Concentrations (MIC)}
\format{
An object of class \code{mic} (inherits from \code{ordered}, \code{factor}) of length 1.
}
\usage{
as.mic(x, na.rm = FALSE)
NA_mic_
is.mic(x)
\method{droplevels}{mic}(
x,
exclude = if (any(is.na(levels(x)))) NULL else NA,
as.mic = FALSE,
...
)
}
\arguments{
\item{x}{a \link{character} or \link{numeric} vector}
\item{na.rm}{a \link{logical} indicating whether missing values should be removed}
\item{exclude}{factor levels which should be excluded from the result even if present, see \link[base:droplevels]{droplevels()}}
\item{as.mic}{a \link{logical} to indicate whether the \verb{<mic>} class should be kept, defaults to \code{FALSE}}
}
\value{
Ordered \link{factor} with additional class \code{\link{mic}}, that in mathematical operations acts as decimal numbers. Bare in mind that the outcome of any mathematical operation on MICs will return a \link{numeric} value.
@ -29,7 +38,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 and CLSI.
To interpret MIC values as RSI values, use \code{\link[=as.rsi]{as.rsi()}} on MIC values. It supports guidelines from EUCAST (2011-2021) and CLSI (2010-2021).
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:\preformatted{x <- random_mic(10)
x
@ -63,7 +72,11 @@ subset(df, x > 4) # or with dplyr: df \%>\% filter(x > 4)
The following \link[=groupGeneric]{generic functions} are implemented for the MIC class: \code{!}, \code{!=}, \code{\%\%}, \code{\%/\%}, \code{&}, \code{*}, \code{+}, \code{-}, \code{/}, \code{<}, \code{<=}, \code{==}, \code{>}, \code{>=}, \code{^}, \code{|}, \code{\link[=abs]{abs()}}, \code{\link[=acos]{acos()}}, \code{\link[=acosh]{acosh()}}, \code{\link[=all]{all()}}, \code{\link[=any]{any()}}, \code{\link[=asin]{asin()}}, \code{\link[=asinh]{asinh()}}, \code{\link[=atan]{atan()}}, \code{\link[=atanh]{atanh()}}, \code{\link[=ceiling]{ceiling()}}, \code{\link[=cos]{cos()}}, \code{\link[=cosh]{cosh()}}, \code{\link[=cospi]{cospi()}}, \code{\link[=cummax]{cummax()}}, \code{\link[=cummin]{cummin()}}, \code{\link[=cumprod]{cumprod()}}, \code{\link[=cumsum]{cumsum()}}, \code{\link[=digamma]{digamma()}}, \code{\link[=exp]{exp()}}, \code{\link[=expm1]{expm1()}}, \code{\link[=floor]{floor()}}, \code{\link[=gamma]{gamma()}}, \code{\link[=lgamma]{lgamma()}}, \code{\link[=log]{log()}}, \code{\link[=log1p]{log1p()}}, \code{\link[=log2]{log2()}}, \code{\link[=log10]{log10()}}, \code{\link[=max]{max()}}, \code{\link[=mean]{mean()}}, \code{\link[=min]{min()}}, \code{\link[=prod]{prod()}}, \code{\link[=range]{range()}}, \code{\link[=round]{round()}}, \code{\link[=sign]{sign()}}, \code{\link[=signif]{signif()}}, \code{\link[=sin]{sin()}}, \code{\link[=sinh]{sinh()}}, \code{\link[=sinpi]{sinpi()}}, \code{\link[=sqrt]{sqrt()}}, \code{\link[=sum]{sum()}}, \code{\link[=tan]{tan()}}, \code{\link[=tanh]{tanh()}}, \code{\link[=tanpi]{tanpi()}}, \code{\link[=trigamma]{trigamma()}} and \code{\link[=trunc]{trunc()}}. Some functions of the \code{stats} package are also implemented: \code{\link[=median]{median()}}, \code{\link[=quantile]{quantile()}}, \code{\link[=mad]{mad()}}, \code{\link[=IQR]{IQR()}}, \code{\link[=fivenum]{fivenum()}}. Also, \code{\link[=boxplot.stats]{boxplot.stats()}} is supported. Since \code{\link[=sd]{sd()}} and \code{\link[=var]{var()}} are non-generic functions, these could not be extended. Use \code{\link[=mad]{mad()}} as an alternative, or use e.g. \code{sd(as.numeric(x))} where \code{x} is your vector of MIC values.
\code{NA_mic_} is a missing value of the new \verb{<mic>} class.
Using \code{\link[=as.double]{as.double()}} or \code{\link[=as.numeric]{as.numeric()}} on MIC values will remove the operators and return a numeric vector. Do \strong{not} use \code{\link[=as.integer]{as.integer()}} on MIC values as by the \R convention on \link{factor}s, it will return the index of the factor levels (which is often useless for regular users).
Use \code{\link[=droplevels]{droplevels()}} to drop unused levels. At default, it will return a plain factor. Use \code{droplevels(..., as.mic = TRUE)} to maintain the \verb{<mic>} class.
\code{NA_mic_} is a missing value of the new \verb{<mic>} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
}
\section{Stable Lifecycle}{

View File

@ -68,7 +68,7 @@ is.rsi.eligible(x, threshold = 0.05)
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
\item{guideline}{defaults to the latest included EUCAST guideline, see \emph{Details} for all options}
\item{guideline}{defaults to the latest included EUCAST guideline, supports EUCAST (2011-2021) and CLSI (2010-2021), 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}.}
@ -133,7 +133,7 @@ The function \code{\link[=is.rsi]{is.rsi()}} detects if the input contains class
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.
}
\code{NA_rsi_} is a missing value of the new \verb{<rsi>} class.
\code{NA_rsi_} is a missing value of the new \verb{<rsi>} class, analogous to e.g. base \R's \code{\link[base:NA]{NA_character_}}.
}
\section{Interpretation of R and S/I}{
@ -247,7 +247,7 @@ if (require("dplyr")) {
example_isolates \%>\%
mutate_if(is.rsi.eligible, as.rsi)
# note: from dplyr 1.0.0 on, this will be:
# since dplyr 1.0.0, this can also be:
# example_isolates \%>\%
# mutate(across(where(is.rsi.eligible), as.rsi))
}

View File

@ -21,7 +21,7 @@ g.test(x, y = NULL, p = rep(1/length(x), length(x)), rescale.p = FALSE)
\item{y}{a numeric vector; ignored if \code{x} is a matrix. If
\code{x} is a factor, \code{y} should be a factor of the same length.}
\item{p}{a vector of probabilities of the same length of \code{x}.
\item{p}{a vector of probabilities of the same length as \code{x}.
An error is given if any entry of \code{p} is negative.}
\item{rescale.p}{a logical scalar; if TRUE then \code{p} is rescaled

View File

@ -14,7 +14,7 @@ set_mo_source(
get_mo_source(destination = getOption("AMR_mo_source", "~/mo_source.rds"))
}
\arguments{
\item{path}{location of your reference file, see \emph{Details}. Can be \code{""}, \code{NULL} or \code{FALSE} to delete the reference file.}
\item{path}{location of your reference file, this can be any text file (comma-, tab- or pipe-separated) or an Excel file (see \emph{Details}). Can also be \code{""}, \code{NULL} or \code{FALSE} to delete the reference file.}
\item{destination}{destination of the compressed data file, default to the user's home directory.}
}
@ -26,9 +26,9 @@ This is \strong{the fastest way} to have your organisation (or analysis) specifi
\details{
The reference file can be a text file separated with commas (CSV) or tabs or pipes, an Excel file (either 'xls' or 'xlsx' format) or an \R object file (extension '.rds'). To use an Excel file, you will need to have the \code{readxl} package installed.
\code{\link[=set_mo_source]{set_mo_source()}} will check the file for validity: it must be a \link{data.frame}, must have a column named \code{"mo"} which contains values from \code{\link[=microorganisms]{microorganisms$mo}} and must have a reference column with your own defined values. If all tests pass, \code{\link[=set_mo_source]{set_mo_source()}} will read the file into \R and will ask to export it to \code{"~/mo_source.rds"}. The CRAN policy disallows packages to write to the file system, although '\emph{exceptions may be allowed in interactive sessions if the package obtains confirmation from the user}'. For this reason, this function only works in interactive sessions so that the user can \strong{specifically confirm and allow} that this file will be created. The destination of this file can be set with the \code{destination} argument and defaults to the user's home directory. It can also be set as an \R option, using \code{options(AMR_mo_source = "my/location/file.rds")}.
\code{\link[=set_mo_source]{set_mo_source()}} will check the file for validity: it must be a \link{data.frame}, must have a column named \code{"mo"} which contains values from \code{\link[=microorganisms]{microorganisms$mo}} or \code{\link[=microorganisms]{microorganisms$fullname}} and must have a reference column with your own defined values. If all tests pass, \code{\link[=set_mo_source]{set_mo_source()}} will read the file into \R and will ask to export it to \code{"~/mo_source.rds"}. The CRAN policy disallows packages to write to the file system, although '\emph{exceptions may be allowed in interactive sessions if the package obtains confirmation from the user}'. For this reason, this function only works in interactive sessions so that the user can \strong{specifically confirm and allow} that this file will be created. The destination of this file can be set with the \code{destination} argument and defaults to the user's home directory. It can also be set as an \R option, using \code{options(AMR_mo_source = "my/location/file.rds")}.
The created compressed data file \code{"mo_source.rds"} will be used at default for MO determination (function \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}). The location and timestamp of the original file will be saved as an attribute to the compressed data file.
The created compressed data file \code{"mo_source.rds"} will be used at default for MO determination (function \code{\link[=as.mo]{as.mo()}} and consequently all \verb{mo_*} functions like \code{\link[=mo_genus]{mo_genus()}} and \code{\link[=mo_gramstain]{mo_gramstain()}}). The location and timestamp of the original file will be saved as an \link[base:attributes]{attribute} to the compressed data file.
The function \code{\link[=get_mo_source]{get_mo_source()}} will return the data set by reading \code{"mo_source.rds"} with \code{\link[=readRDS]{readRDS()}}. If the original file has changed (by checking the location and timestamp of the original file), it will call \code{\link[=set_mo_source]{set_mo_source()}} to update the data file automatically if used in an interactive session.
@ -37,12 +37,12 @@ Reading an Excel file (\code{.xlsx}) with only one row has a size of 8-9 kB. The
\section{How to Setup}{
Imagine this data on a sheet of an Excel file (mo codes were looked up in the \link{microorganisms} data set). The first column contains the organisation specific codes, the second column contains an MO code from this package:\preformatted{ | A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
4 | | |
Imagine this data on a sheet of an Excel file. The first column contains the organisation specific codes, the second column contains valid taxonomic names:\preformatted{ | A | B |
--|--------------------|-----------------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | Escherichia coli |
3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
4 | | |
}
We save it as \code{"home/me/ourcodes.xlsx"}. Now we have to set it as a source:\preformatted{set_mo_source("home/me/ourcodes.xlsx")
@ -68,13 +68,13 @@ as.mo(c("Escherichia coli", "E. coli", "lab_mo_ecoli"))
#> [1] B_ESCHR_COLI B_ESCHR_COLI B_ESCHR_COLI
}
If we edit the Excel file by, let's say, adding row 4 like this:\preformatted{ | A | B |
--|--------------------|--------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | B_ESCHR_COLI |
3 | lab_mo_kpneumoniae | B_KLBSL_PNMN |
4 | lab_Staph_aureus | B_STPHY_AURS |
5 | | |
If we edit the Excel file by, let's say, adding row 4 like this:\preformatted{ | A | B |
--|--------------------|-----------------------|
1 | Organisation XYZ | mo |
2 | lab_mo_ecoli | Escherichia coli |
3 | lab_mo_kpneumoniae | Klebsiella pneumoniae |
4 | lab_Staph_aureus | Staphylococcus aureus |
5 | | |
}
...any new usage of an MO function in this package will update your data file:\preformatted{as.mo("lab_mo_ecoli")