1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 17:26:12 +01:00

(v0.9.0.9016) Support SNOMED codes

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-01-27 19:14:23 +01:00
parent 42b079cdb7
commit a13c62e6e8
31 changed files with 456 additions and 342 deletions

View File

@ -1,5 +1,5 @@
Package: AMR
Version: 0.9.0.9015
Version: 0.9.0.9016
Date: 2020-01-27
Title: Antimicrobial Resistance Analysis
Authors@R: c(

View File

@ -157,6 +157,7 @@ export(mo_rank)
export(mo_ref)
export(mo_renamed)
export(mo_shortname)
export(mo_snomed)
export(mo_species)
export(mo_subspecies)
export(mo_synonyms)

32
NEWS.md
View File

@ -1,17 +1,27 @@
# AMR 0.9.0.9015
# AMR 0.9.0.9016
## <small>Last updated: 27-Jan-2020</small>
### New
* Support for LOINC codes in the `antibiotics` data set. Use `ab_loinc()` to retrieve LOINC codes, or use a LOINC code for input in any `ab_*` function:
```r
ab_loinc("ampicillin")
#> [1] "21066-6" "3355-5" "33562-0" "33919-2" "43883-8" "43884-6" "87604-5"
ab_name("21066-6")
#> [1] "Ampicillin"
ab_atc("21066-6")
#> [1] "J01CA01"
```
* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2019 to translate MIC and disk diffusion values to R/SI: https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt. This **allows machine reading these guidelines**, which is currently almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.
* Support for LOINC and SNOMED codes
* Support for LOINC codes in the `antibiotics` data set. Use `ab_loinc()` to retrieve LOINC codes, or use a LOINC code for input in any `ab_*` function:
```r
ab_loinc("ampicillin")
#> [1] "21066-6" "3355-5" "33562-0" "33919-2" "43883-8" "43884-6" "87604-5"
ab_name("21066-6")
#> [1] "Ampicillin"
ab_atc("21066-6")
#> [1] "J01CA01"
```
* Support for SNOMED CT codes in the `microorganisms` data set. Use `mo_snomed()` to retrieve SNOMED codes, or use a SNOMED code for input in any `mo_*` function:
```r
mo_snomed("S. aureus")
#> [1] 115329001 3092008 113961008
mo_name(115329001)
#> [1] "Staphylococcus aureus"
mo_gramstain(115329001)
#> [1] "Gram-positive"
```
* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2019 to translate MIC and disk diffusion values to R/SI: https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt. This **allows for machine reading these guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.
### Changes
* Bugfix for some WHONET microorganism codes that were not interpreted correctly when using `as.rsi()`

View File

@ -69,7 +69,7 @@
#'
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using [as.mo()].
#' @inheritSection catalogue_of_life Catalogue of Life
#' @format A [`data.frame`] with 69,447 observations and 16 variables:
#' @format A [`data.frame`] with 69,447 observations and 17 variables:
#' - `mo`\cr ID of microorganism as used by this package
#' - `col_id`\cr Catalogue of Life ID
#' - `fullname`\cr Full name, like `"Escherichia coli"`
@ -79,6 +79,7 @@
#' - `species_id`\cr ID of the species as used by the Catalogue of Life
#' - `source`\cr Either "CoL", "DSMZ" (see Source) or "manually added"
#' - `prevalence`\cr Prevalence of the microorganism, see [as.mo()]
#' - `snomed`\cr SNOMED code of the microorganism. Use [mo_snomed()] to retrieve it quickly, see [mo_property()].
#' @details Manually added were:
#' - 11 entries of *Streptococcus* (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)
#' - 2 entries of *Staphylococcus* (coagulase-negative (CoNS) and coagulase-positive (CoPS))
@ -145,7 +146,7 @@ catalogue_of_life <- list(
#' - `gender`\cr gender of the patient
#' - `patient_id`\cr ID of the patient
#' - `mo`\cr ID of microorganism created with [as.mo()], see also [microorganisms]
#' - `PEN:RIF`\cr 40 different antibiotics with class [`rsi`] (see [as.rsi()]); these column names occur in [antibiotics] data set and can be translated with [ab_name()]
#' - `PEN:RIF`\cr 40 different antibiotics with class [`rsi`] (see [as.rsi()]); these column names occur in the [antibiotics] data set and can be translated with [ab_name()]
#' @inheritSection AMR Read more on our website!
"example_isolates"
@ -182,9 +183,9 @@ catalogue_of_life <- list(
#' @inheritSection AMR Read more on our website!
"WHONET"
#' Data set for RSI interpretation
#' Data set for R/SI interpretation
#'
#' Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use [as.rsi()] to transform MICs or disks measurements to RSI values.
#' Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use [as.rsi()] to transform MICs or disks measurements to R/SI values.
#' @format A [`data.frame`] with 13,975 observations and 9 variables:
#' - `guideline`\cr Name of the guideline
#' - `method`\cr Either "MIC" or "DISK"
@ -195,32 +196,7 @@ catalogue_of_life <- list(
#' - `disk_dose`\cr Dose of the used disk diffusion method
#' - `breakpoint_S`\cr Lowest MIC value or highest number of millimeters that leads to "S"
#' - `breakpoint_R`\cr Highest MIC value or lowest number of millimeters that leads to "R"
#' @details The repository of this `AMR` package contains a file comprising this exact data set: [https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt]. This file **allows for machine reading EUCAST and CLSI guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.
#' @inheritSection AMR Read more on our website!
"rsi_translation"
# transforms data set to data.frame with only ASCII values, to comply with CRAN policies
dataset_UTF8_to_ASCII <- function(df) {
trans <- function(vect) {
iconv(vect, from = "UTF-8", to = "ASCII//TRANSLIT")
}
df <- as.data.frame(df, stringsAsFactors = FALSE)
for (i in seq_len(NCOL(df))) {
col <- df[, i]
if (is.list(col)) {
for (j in seq_len(length(col))) {
col[[j]] <- trans(col[[j]])
}
df[, i] <- list(col)
} else {
if (is.factor(col)) {
levels(col) <- trans(levels(col))
} else if (is.character(col)) {
col <- trans(col)
} else {
col
}
df[, i] <- col
}
}
df
}

View File

@ -144,3 +144,31 @@ class_integrity_check <- function(value, type, check_vector) {
}
value
}
# transforms data set to data.frame with only ASCII values, to comply with CRAN policies
dataset_UTF8_to_ASCII <- function(df) {
trans <- function(vect) {
iconv(vect, from = "UTF-8", to = "ASCII//TRANSLIT")
}
df <- as.data.frame(df, stringsAsFactors = FALSE)
for (i in seq_len(NCOL(df))) {
col <- df[, i]
if (is.list(col)) {
col <- lapply(col, function(j) trans(j))
# for (j in seq_len(length(col))) {
# col[[j]] <- trans(col[[j]])
# }
df[, i] <- list(col)
} else {
if (is.factor(col)) {
levels(col) <- trans(levels(col))
} else if (is.character(col)) {
col <- trans(col)
} else {
col
}
df[, i] <- col
}
}
df
}

66
R/mo.R
View File

@ -132,11 +132,12 @@
#' as.mo("Staphylococcus aureus")
#' as.mo("Staphylococcus aureus (MRSA)")
#' as.mo("Zthafilokkoockus oureuz") # handles incorrect spelling
#' as.mo("MRSA") # Methicillin Resistant S. aureus
#' as.mo("VISA") # Vancomycin Intermediate S. aureus
#' as.mo("VRSA") # Vancomycin Resistant S. aureus
#' as.mo(22242419) # Catalogue of Life ID
#'
#' as.mo("MRSA") # Methicillin Resistant S. aureus
#' as.mo("VISA") # Vancomycin Intermediate S. aureus
#' as.mo("VRSA") # Vancomycin Resistant S. aureus
#' as.mo(22242419) # Catalogue of Life ID
#' as.mo(115329001) # SNOMED CT code
#'
#' # Dyslexia is no problem - these all work:
#' as.mo("Ureaplasma urealyticum")
#' as.mo("Ureaplasma urealyticus")
@ -567,11 +568,29 @@ exec_as.mo <- function(x,
cat(paste0(blue("x_trimmed_without_group"), ' "', x_trimmed_without_group, '"\n'))
}
progress <- progress_estimated(n = length(x), min_time = 3)
if (initial_search == TRUE) {
progress <- progress_estimated(n = length(x), min_time = 3)
# before we start, omit the ones that are obvious - MO codes and full names
skip_vect <- rep(FALSE, length(x))
skip_vect[toupper(x_backup) %in% reference_data_to_use$mo] <- TRUE
skip_vect[tolower(x_backup) %in% reference_data_to_use$fullname_lower] <- TRUE
x[toupper(x_backup) %in% reference_data_to_use$mo] <- reference_data_to_use[data.table(mo = toupper(x_backup[toupper(x_backup) %in% reference_data_to_use$mo])),
on = "mo",
..property][[1]]
x[tolower(x_backup) %in% reference_data_to_use$fullname_lower] <- reference_data_to_use[data.table(fullname_lower = tolower(x_backup[tolower(x_backup) %in% reference_data_to_use$fullname_lower])),
on = "fullname_lower",
..property][[1]]
}
for (i in seq_len(length(x))) {
progress$tick()$print()
if (initial_search == TRUE) {
progress$tick()$print()
if (isTRUE(skip_vect[i])) {
next
}
}
mo_hist <- get_mo_history(x_backup[i], uncertainty_level, force = force_mo_history, disable = disable_mo_history)
if (initial_search == TRUE & !any(is.na(mo_hist))) {
@ -633,10 +652,27 @@ exec_as.mo <- function(x,
next
}
# exact SNOMED code
if (x_backup[i] %like% "^[0-9]+$") {
snomed_found <- unlist(lapply(reference_data_to_use$snomed,
function(s) if (x_backup[i] %in% s) {
TRUE
} else {
FALSE
}))
found <- reference_data_to_use[snomed_found == TRUE,
..property][[1]]
if (length(found) > 0) {
x[i] <- found[1L]
# don't save to history, as all items are already in microorganisms
next
}
}
# very probable: is G. species
found <- reference_data_to_use[g_species %in% gsub("[^a-z0-9/ \\-]+", "",
tolower(c(x_backup[i], x_backup_without_spp[i]))),
..property][[1]]
# very probable: is G. species
if (length(found) > 0) {
x[i] <- found[1L]
if (initial_search == TRUE) {
@ -1634,6 +1670,7 @@ exec_as.mo <- function(x,
msg <- paste0(msg, ": ", paste('"', unique(failures), '"', sep = "", collapse = ", "))
}
msg <- paste0(msg, ". Use mo_failures() to review ", plural[2], ". Edit the `allow_uncertain` parameter if needed (see ?as.mo).")
cat("\n")
warning(red(msg),
call. = FALSE,
immediate. = TRUE) # thus will always be shown, even if >= warnings
@ -1646,8 +1683,9 @@ exec_as.mo <- function(x,
if (NROW(uncertainties) > 1) {
plural <- c("s", "them", "were")
}
msg <- paste0("\nResult", plural[1], " of ", nr2char(NROW(uncertainties)), " value", plural[1],
msg <- paste0("Result", plural[1], " of ", nr2char(NROW(uncertainties)), " value", plural[1],
" ", plural[3], " guessed with uncertainty. Use mo_uncertainties() to review ", plural[2], ".")
cat("\n")
warning(red(msg),
call. = FALSE,
immediate. = TRUE) # thus will always be shown, even if >= warnings
@ -2036,6 +2074,14 @@ unregex <- function(x) {
get_mo_code <- function(x, property) {
if (property == "mo") {
unique(x)
} else if (property == "snomed") {
found <- unlist(lapply(microorganismsDT$snomed,
function(s) if (any(x %in% s, na.rm = TRUE)) {
TRUE
} else {
FALSE
}))
microorganismsDT$mo[found == TRUE]
} else {
microorganismsDT[get(property) == x, "mo"][[1]]
}

View File

@ -45,6 +45,7 @@
#' - An [`integer`] in case of [mo_year()]
#' - A [`list`] in case of [mo_taxonomy()] and [mo_info()]
#' - A named [`character`] in case of [mo_url()]
#' - A [`double`] in case of [mo_snomed()]
#' - A [`character`] in all other cases
#' @export
#' @seealso [microorganisms]
@ -62,11 +63,12 @@
#'
#' # colloquial properties ----------------------------------------------------
#' mo_name("E. coli") # "Escherichia coli"
#' mo_fullname("E. coli") # "Escherichia coli", same as mo_name()
#' mo_fullname("E. coli") # "Escherichia coli" - same as mo_name()
#' mo_shortname("E. coli") # "E. coli"
#'
#' # other properties ---------------------------------------------------------
#' mo_gramstain("E. coli") # "Gram-negative"
#' mo_snomed("E. coli") # 112283007, 116395006, ... (SNOMED codes)
#' mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated)
#' mo_rank("E. coli") # "species"
#' mo_url("E. coli") # get the direct url to the online database entry
@ -249,6 +251,12 @@ mo_gramstain <- function(x, language = get_locale(), ...) {
translate_AMR(x, language = language, only_unknown = FALSE)
}
#' @rdname mo_property
#' @export
mo_snomed <- function(x, ...) {
mo_validate(x = x, property = "snomed", ...)
}
#' @rdname mo_property
#' @export
mo_ref <- function(x, ...) {
@ -428,6 +436,8 @@ mo_validate <- function(x, property, ...) {
return(to_class_mo(x))
} else if (property == "col_id") {
return(as.integer(x))
} else if (property == "snomed") {
return(as.double(eval(parse(text = x))))
} else {
return(x)
}

View File

@ -21,8 +21,6 @@
#' @importFrom data.table as.data.table setkey
.onLoad <- function(libname, pkgname) {
# packageStartupMessage("Loading taxonomic reference data")
# get new functions not available in older versions of R
backports::import(pkgname)

View File

@ -20,7 +20,36 @@
# ==================================================================== #
library(AMR)
library(dplyr)
library(tidyverse)
# go to https://www.nictiz.nl/standaardisatie/terminologiecentrum/referentielijsten/micro-organismen/
# read the table from clipboard
snomed <- clipr::read_clip_tbl()
# snomed <- snomed %>%
# transmute(fullname = trimws(gsub("^genus", "", Omschrijving, ignore.case = TRUE)),
# snomed = as.integer(Id))
snomed <- snomed %>%
transmute(fullname = mo_name(Omschrijving),
snomed = as.integer(Id)) %>%
filter(!fullname %like% "unknown")
snomed_trans <- snomed %>%
group_by(fullname) %>%
mutate(snomed_list = list(snomed)) %>%
ungroup() %>%
select(fullname, snomed = snomed_list) %>%
distinct(fullname, .keep_all = TRUE)
microorganisms <- AMR::microorganisms %>%
left_join(snomed_trans)
# remove the NULLs, set to NA
microorganisms$snomed <- lapply(microorganisms$snomed, function(x) if (length(x) == 0) NA else x)
microorganisms <- dataset_UTF8_to_ASCII(microorganisms)
usethis::use_data(microorganisms, overwrite = TRUE)
rm(microorganisms)
# OLD ---------------------------------------------------------------------
baseUrl <- 'https://browser.ihtsdotools.org/snowstorm/snomed-ct'
edition <- 'MAIN'

Binary file not shown.

View File

@ -84,7 +84,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>

View File

@ -84,7 +84,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>

View File

@ -84,7 +84,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>

View File

@ -84,7 +84,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>

View File

@ -45,7 +45,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -200,7 +200,7 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/
<a href="#what-is-amr-for-r" class="anchor"></a>What is <code>AMR</code> (for R)?</h3>
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
<p><code>AMR</code> is a free and open-source <a href="https://www.r-project.org">R package</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 antimicrobial resistance 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>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC and LOINC), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~70,000 distinct microbial species</strong></a> and all <a href="./reference/antibiotics.html"><strong>~550 antibiotic, antimycotic and antiviral drugs</strong></a> by name and code (including ATC, 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>We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is <a href="./news">actively maintained</a> and is free software (see <a href="#copyright">Copyright</a>).</p>
<div class="main-content">
<p>
@ -238,35 +238,25 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/
<li>Getting properties for any antibiotic (like name, EARS-Net code, ATC code, PubChem code, 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 get its name associated with a SNOMED code (<a href="./reference/mo_property.html">manual</a>)</li>
<li>Getting LOINC codes of an antibiotic, or get its name associated with a LOINC code (<a href="./reference/ab_property.html">manual</a>)</li>
<li>Machine reading the EUCAST and CLSI guidelines from 2011-2019 to translate MIC values and disk diffusion diameters to R/SI (<a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt">link</a>)</li>
</ul>
<p>This package is ready-to-use for a professional environment by specialists in the following fields:</p>
<p>Medical Microbiology</p>
<p>This package is ready-to-use for specialists in many fields:</p>
<ul>
<li>Epidemiologists (both clinical microbiological and research)</li>
<li>Research Microbiologists</li>
<li>(Research) Microbiologists</li>
<li>Biomedical Researchers</li>
<li>Research Pharmacologists</li>
<li>Data Scientists / Data Analysts</li>
</ul>
<p>Veterinary Microbiology</p>
<ul>
<li>Statisticians</li>
<li>Bioinformaticians</li>
<li>Research Veterinarians</li>
<li>Veterinary Epidemiologists</li>
</ul>
<p>Microbial Ecology</p>
<ul>
<li>Soil Microbiologists</li>
<li>Extremophile Researchers</li>
<li>Astrobiologists</li>
</ul>
<p>Developers</p>
<ul>
<li>Package developers for R</li>
<li>Software developers</li>
<li>Web application / Shiny developers</li>
</ul>
</div>
<div id="get-this-package" class="section level3">
<h3 class="hasAnchor">
@ -338,8 +328,8 @@ A methods paper about this package has been preprinted at bioRxiv (DOI: 10.1101/
</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">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>. As they 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><a href="reference/mo_property.html">mo_genus("MRSA")</a></code> and <code><a href="reference/mo_property.html">mo_genus("S. aureus")</a></code> will both return <code>"Staphylococcus"</code>. They also come with support for German, 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, 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> 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><a href="reference/ab_property.html">ab_name("Fluclox")</a></code>, <code><a href="reference/ab_property.html">ab_name("Floxapen")</a></code> and <code><a href="reference/ab_property.html">ab_name("J01CF05")</a></code> will all return <code>"Flucloxacillin"</code>. These functions can again be used to add new variables to your data.</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><a href="reference/mo_property.html">mo_genus("MRSA")</a></code> and <code><a href="reference/mo_property.html">mo_genus("S. aureus")</a></code> will both return <code>"Staphylococcus"</code>. They also come with support for German, 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><a href="reference/ab_property.html">ab_name("Fluclox")</a></code>, <code><a href="reference/ab_property.html">ab_name("Floxapen")</a></code> and <code><a href="reference/ab_property.html">ab_name("J01CF05")</a></code> will all return <code>"Flucloxacillin"</code>. These functions can again be used to add new variables to your data.</li>
</ul>
</li>
<li>

View File

@ -84,7 +84,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -231,9 +231,9 @@
</div>
<div id="amr-0-9-0-9015" class="section level1">
<div id="amr-0-9-0-9016" class="section level1">
<h1 class="page-header">
<a href="#amr-0-9-0-9015" class="anchor"></a>AMR 0.9.0.9015<small> Unreleased </small>
<a href="#amr-0-9-0-9016" class="anchor"></a>AMR 0.9.0.9016<small> Unreleased </small>
</h1>
<div id="last-updated-27-jan-2020" class="section level2">
<h2 class="hasAnchor">
@ -243,6 +243,8 @@
<h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3>
<ul>
<li>Support for LOINC and SNOMED codes
<ul>
<li>
<p>Support for LOINC codes in the <code>antibiotics</code> data set. Use <code><a href="../reference/ab_property.html">ab_loinc()</a></code> to retrieve LOINC codes, or use a LOINC code for input in any <code>ab_*</code> function:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="../reference/ab_property.html">ab_loinc</a></span>(<span class="st">"ampicillin"</span>)</a>
@ -252,7 +254,18 @@
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="st">"21066-6"</span>)</a>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co">#&gt; [1] "J01CA01"</span></a></code></pre></div>
</li>
<li><p>The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2019 to translate MIC and disk diffusion values to R/SI: <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt" class="uri">https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt</a>. This <strong>allows machine reading these guidelines</strong>, which is currently almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.</p></li>
<li>
<p>Support for SNOMED CT codes in the <code>microorganisms</code> data set. Use <code><a href="../reference/mo_property.html">mo_snomed()</a></code> to retrieve SNOMED codes, or use a SNOMED code for input in any <code>mo_*</code> function:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_snomed</a></span>(<span class="st">"S. aureus"</span>)</a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="co">#&gt; [1] 115329001 3092008 113961008</span></a>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="dv">115329001</span>)</a>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co">#&gt; [1] "Staphylococcus aureus"</span></a>
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="dv">115329001</span>)</a>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="co">#&gt; [1] "Gram-positive"</span></a></code></pre></div>
</li>
</ul>
</li>
<li>The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2019 to translate MIC and disk diffusion values to R/SI: <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt" class="uri">https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt</a>. This <strong>allows for machine reading these guidelines</strong>, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.</li>
</ul>
</div>
<div id="changes" class="section level3">
@ -299,9 +312,9 @@
<ul>
<li>
<p>If you were dependent on the old Enterobacteriaceae family e.g. by using in your code:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(somebugs) <span class="op">==</span><span class="st"> "Enterobacteriaceae"</span>) ...</a></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(somebugs) <span class="op">==</span><span class="st"> "Enterobacteriaceae"</span>) ...</a></code></pre></div>
<p>then please adjust this to:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(somebugs) <span class="op">==</span><span class="st"> "Enterobacterales"</span>) ...</a></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="cf">if</span> (<span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(somebugs) <span class="op">==</span><span class="st"> "Enterobacterales"</span>) ...</a></code></pre></div>
</li>
</ul>
</li>
@ -313,12 +326,12 @@
<ul>
<li>
<p>Functions <code><a href="../reference/proportion.html">susceptibility()</a></code> and <code><a href="../reference/proportion.html">resistance()</a></code> as aliases of <code><a href="../reference/proportion.html">proportion_SI()</a></code> and <code><a href="../reference/proportion.html">proportion_R()</a></code>, respectively. These functions were added to make it more clear that “I” should be considered susceptible and not resistant.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb4-2" data-line-number="2">example_isolates <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="dt">bug =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(mo)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMX),</a>
<a class="sourceLine" id="cb4-5" data-line-number="5"> <span class="dt">amox_clav =</span> <span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMC)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(amoxicillin) <span class="op">|</span><span class="st"> </span><span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(amox_clav))</a></code></pre></div>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb5-2" data-line-number="2">example_isolates <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="dt">bug =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(mo)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="dt">amoxicillin =</span> <span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMX),</a>
<a class="sourceLine" id="cb5-5" data-line-number="5"> <span class="dt">amox_clav =</span> <span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMC)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(amoxicillin) <span class="op">|</span><span class="st"> </span><span class="op">!</span><span class="kw"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(amox_clav))</a></code></pre></div>
</li>
<li>Support for a new MDRO guideline: Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012).
<ul>
@ -339,16 +352,16 @@
<li>More intelligent way of coping with some consonants like “l” and “r”</li>
<li>
<p>Added a score (a certainty percentage) to <code><a href="../reference/as.mo.html">mo_uncertainties()</a></code>, that is calculated using the <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance</a>:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Stafylococcus aureus"</span>,</a>
<a class="sourceLine" id="cb5-2" data-line-number="2"> <span class="st">"staphylokok aureuz"</span>))</a>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co">#&gt; Warning: </span></a>
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="co">#&gt; Results of two values were guessed with uncertainty. Use mo_uncertainties() to review them.</span></a>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="co">#&gt; Class 'mo'</span></a>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co">#&gt; [1] B_STPHY_AURS B_STPHY_AURS</span></a>
<a class="sourceLine" id="cb5-7" data-line-number="7"></a>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="kw"><a href="../reference/as.mo.html">mo_uncertainties</a></span>()</a>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co">#&gt; "Stafylococcus aureus" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 95.2%)</span></a>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co">#&gt; "staphylokok aureuz" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 85.7%)</span></a></code></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Stafylococcus aureus"</span>,</a>
<a class="sourceLine" id="cb6-2" data-line-number="2"> <span class="st">"staphylokok aureuz"</span>))</a>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="co">#&gt; Warning: </span></a>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co">#&gt; Results of two values were guessed with uncertainty. Use mo_uncertainties() to review them.</span></a>
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="co">#&gt; Class 'mo'</span></a>
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co">#&gt; [1] B_STPHY_AURS B_STPHY_AURS</span></a>
<a class="sourceLine" id="cb6-7" data-line-number="7"></a>
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="kw"><a href="../reference/as.mo.html">mo_uncertainties</a></span>()</a>
<a class="sourceLine" id="cb6-9" data-line-number="9"><span class="co">#&gt; "Stafylococcus aureus" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 95.2%)</span></a>
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="co">#&gt; "staphylokok aureuz" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 85.7%)</span></a></code></pre></div>
</li>
</ul>
</li>
@ -396,21 +409,21 @@
<ul>
<li>
<p>Determination of first isolates now <strong>excludes</strong> all unknown microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new parameter <code>include_unknown</code>:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(..., <span class="dt">include_unknown =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(..., <span class="dt">include_unknown =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
For WHONET users, this means that all records/isolates with organism code <code>"con"</code> (<em>contamination</em>) will be excluded at default, since <code>as.mo("con") = "UNKNOWN"</code>. The function always shows a note with the number of unknown microorganisms that were included or excluded.</li>
<li>
<p>For code consistency, classes <code>ab</code> and <code>mo</code> will now be preserved in any subsetting or assignment. For the sake of data integrity, this means that invalid assignments will now result in <code>NA</code>:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="co"># how it works in base R:</span></a>
<a class="sourceLine" id="cb7-2" data-line-number="2">x &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/factor.html">factor</a></span>(<span class="st">"A"</span>)</a>
<a class="sourceLine" id="cb7-3" data-line-number="3">x[<span class="dv">1</span>] &lt;-<span class="st"> "B"</span></a>
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="co">#&gt; Warning message:</span></a>
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co">#&gt; invalid factor level, NA generated</span></a>
<a class="sourceLine" id="cb7-6" data-line-number="6"></a>
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="co"># how it now works similarly for classes 'mo' and 'ab':</span></a>
<a class="sourceLine" id="cb7-8" data-line-number="8">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb7-9" data-line-number="9">x[<span class="dv">1</span>] &lt;-<span class="st"> "testvalue"</span></a>
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co">#&gt; Warning message:</span></a>
<a class="sourceLine" id="cb7-11" data-line-number="11"><span class="co">#&gt; invalid microorganism code, NA generated</span></a></code></pre></div>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="co"># how it works in base R:</span></a>
<a class="sourceLine" id="cb8-2" data-line-number="2">x &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/factor.html">factor</a></span>(<span class="st">"A"</span>)</a>
<a class="sourceLine" id="cb8-3" data-line-number="3">x[<span class="dv">1</span>] &lt;-<span class="st"> "B"</span></a>
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co">#&gt; Warning message:</span></a>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="co">#&gt; invalid factor level, NA generated</span></a>
<a class="sourceLine" id="cb8-6" data-line-number="6"></a>
<a class="sourceLine" id="cb8-7" data-line-number="7"><span class="co"># how it now works similarly for classes 'mo' and 'ab':</span></a>
<a class="sourceLine" id="cb8-8" data-line-number="8">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb8-9" data-line-number="9">x[<span class="dv">1</span>] &lt;-<span class="st"> "testvalue"</span></a>
<a class="sourceLine" id="cb8-10" data-line-number="10"><span class="co">#&gt; Warning message:</span></a>
<a class="sourceLine" id="cb8-11" data-line-number="11"><span class="co">#&gt; invalid microorganism code, NA generated</span></a></code></pre></div>
This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</li>
<li>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</li>
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
@ -422,55 +435,55 @@ This is important, because a value like <code>"testvalue"</code> could never be
<ul>
<li>
<p>Function <code><a href="../reference/bug_drug_combinations.html">bug_drug_combinations()</a></code> to quickly get a <code>data.frame</code> with the results of all bug-drug combinations in a data set. The column containing microorganism codes is guessed automatically and its input is transformed with <code><a href="../reference/mo_property.html">mo_shortname()</a></code> at default:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(example_isolates)</a>
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb8-3" data-line-number="3">x[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, ]</a>
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co">#&gt; mo ab S I R total</span></a>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="co">#&gt; 1 A. baumannii AMC 0 0 3 3</span></a>
<a class="sourceLine" id="cb8-6" data-line-number="6"><span class="co">#&gt; 2 A. baumannii AMK 0 0 0 0</span></a>
<a class="sourceLine" id="cb8-7" data-line-number="7"><span class="co">#&gt; 3 A. baumannii AMP 0 0 3 3</span></a>
<a class="sourceLine" id="cb8-8" data-line-number="8"><span class="co">#&gt; 4 A. baumannii AMX 0 0 3 3</span></a>
<a class="sourceLine" id="cb8-9" data-line-number="9"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Use 'format()' on this result to get a publicable/printable format.</span></a>
<a class="sourceLine" id="cb8-10" data-line-number="10"></a>
<a class="sourceLine" id="cb8-11" data-line-number="11"><span class="co"># change the transformation with the FUN argument to anything you like:</span></a>
<a class="sourceLine" id="cb8-12" data-line-number="12">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(example_isolates, <span class="dt">FUN =</span> mo_gramstain)</a>
<a class="sourceLine" id="cb8-13" data-line-number="13"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb8-14" data-line-number="14">x[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, ]</a>
<a class="sourceLine" id="cb8-15" data-line-number="15"><span class="co">#&gt; mo ab S I R total</span></a>
<a class="sourceLine" id="cb8-16" data-line-number="16"><span class="co">#&gt; 1 Gram-negative AMC 469 89 174 732</span></a>
<a class="sourceLine" id="cb8-17" data-line-number="17"><span class="co">#&gt; 2 Gram-negative AMK 251 0 2 253</span></a>
<a class="sourceLine" id="cb8-18" data-line-number="18"><span class="co">#&gt; 3 Gram-negative AMP 227 0 405 632</span></a>
<a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co">#&gt; 4 Gram-negative AMX 227 0 405 632</span></a>
<a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Use 'format()' on this result to get a publicable/printable format.</span></a></code></pre></div>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(example_isolates)</a>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb9-3" data-line-number="3">x[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, ]</a>
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="co">#&gt; mo ab S I R total</span></a>
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co">#&gt; 1 A. baumannii AMC 0 0 3 3</span></a>
<a class="sourceLine" id="cb9-6" data-line-number="6"><span class="co">#&gt; 2 A. baumannii AMK 0 0 0 0</span></a>
<a class="sourceLine" id="cb9-7" data-line-number="7"><span class="co">#&gt; 3 A. baumannii AMP 0 0 3 3</span></a>
<a class="sourceLine" id="cb9-8" data-line-number="8"><span class="co">#&gt; 4 A. baumannii AMX 0 0 3 3</span></a>
<a class="sourceLine" id="cb9-9" data-line-number="9"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Use 'format()' on this result to get a publicable/printable format.</span></a>
<a class="sourceLine" id="cb9-10" data-line-number="10"></a>
<a class="sourceLine" id="cb9-11" data-line-number="11"><span class="co"># change the transformation with the FUN argument to anything you like:</span></a>
<a class="sourceLine" id="cb9-12" data-line-number="12">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(example_isolates, <span class="dt">FUN =</span> mo_gramstain)</a>
<a class="sourceLine" id="cb9-13" data-line-number="13"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb9-14" data-line-number="14">x[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>, ]</a>
<a class="sourceLine" id="cb9-15" data-line-number="15"><span class="co">#&gt; mo ab S I R total</span></a>
<a class="sourceLine" id="cb9-16" data-line-number="16"><span class="co">#&gt; 1 Gram-negative AMC 469 89 174 732</span></a>
<a class="sourceLine" id="cb9-17" data-line-number="17"><span class="co">#&gt; 2 Gram-negative AMK 251 0 2 253</span></a>
<a class="sourceLine" id="cb9-18" data-line-number="18"><span class="co">#&gt; 3 Gram-negative AMP 227 0 405 632</span></a>
<a class="sourceLine" id="cb9-19" data-line-number="19"><span class="co">#&gt; 4 Gram-negative AMX 227 0 405 632</span></a>
<a class="sourceLine" id="cb9-20" data-line-number="20"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Use 'format()' on this result to get a publicable/printable format.</span></a></code></pre></div>
<p>You can format this to a printable format, ready for reporting or exporting to e.g. Excel with the base R <code><a href="https://rdrr.io/r/base/format.html">format()</a></code> function:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/format.html">format</a></span>(x, <span class="dt">combine_IR =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/format.html">format</a></span>(x, <span class="dt">combine_IR =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
</li>
<li>
<p>Additional way to calculate co-resistance, i.e. when using multiple antimicrobials as input for <code>portion_*</code> functions or <code>count_*</code> functions. This can be used to determine the empiric susceptibility of a combination therapy. A new parameter <code>only_all_tested</code> (<strong>which defaults to <code>FALSE</code></strong>) replaces the old <code>also_single_tested</code> and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the <code>portion</code> and <code>count</code> help pages), where the %SI is being determined:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="co"># --------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span></a>
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="co"># ----------------------- -----------------------</span></a>
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="co"># Drug A Drug B include as include as include as include as</span></a>
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="co"># numerator denominator numerator denominator</span></a>
<a class="sourceLine" id="cb10-6" data-line-number="6"><span class="co"># -------- -------- ---------- ----------- ---------- -----------</span></a>
<a class="sourceLine" id="cb10-7" data-line-number="7"><span class="co"># S or I S or I X X X X</span></a>
<a class="sourceLine" id="cb10-8" data-line-number="8"><span class="co"># R S or I X X X X</span></a>
<a class="sourceLine" id="cb10-9" data-line-number="9"><span class="co"># &lt;NA&gt; S or I X X - -</span></a>
<a class="sourceLine" id="cb10-10" data-line-number="10"><span class="co"># S or I R X X X X</span></a>
<a class="sourceLine" id="cb10-11" data-line-number="11"><span class="co"># R R - X - X</span></a>
<a class="sourceLine" id="cb10-12" data-line-number="12"><span class="co"># &lt;NA&gt; R - - - -</span></a>
<a class="sourceLine" id="cb10-13" data-line-number="13"><span class="co"># S or I &lt;NA&gt; X X - -</span></a>
<a class="sourceLine" id="cb10-14" data-line-number="14"><span class="co"># R &lt;NA&gt; - - - -</span></a>
<a class="sourceLine" id="cb10-15" data-line-number="15"><span class="co"># &lt;NA&gt; &lt;NA&gt; - - - -</span></a>
<a class="sourceLine" id="cb10-16" data-line-number="16"><span class="co"># --------------------------------------------------------------------</span></a></code></pre></div>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="co"># --------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span></a>
<a class="sourceLine" id="cb11-3" data-line-number="3"><span class="co"># ----------------------- -----------------------</span></a>
<a class="sourceLine" id="cb11-4" data-line-number="4"><span class="co"># Drug A Drug B include as include as include as include as</span></a>
<a class="sourceLine" id="cb11-5" data-line-number="5"><span class="co"># numerator denominator numerator denominator</span></a>
<a class="sourceLine" id="cb11-6" data-line-number="6"><span class="co"># -------- -------- ---------- ----------- ---------- -----------</span></a>
<a class="sourceLine" id="cb11-7" data-line-number="7"><span class="co"># S or I S or I X X X X</span></a>
<a class="sourceLine" id="cb11-8" data-line-number="8"><span class="co"># R S or I X X X X</span></a>
<a class="sourceLine" id="cb11-9" data-line-number="9"><span class="co"># &lt;NA&gt; S or I X X - -</span></a>
<a class="sourceLine" id="cb11-10" data-line-number="10"><span class="co"># S or I R X X X X</span></a>
<a class="sourceLine" id="cb11-11" data-line-number="11"><span class="co"># R R - X - X</span></a>
<a class="sourceLine" id="cb11-12" data-line-number="12"><span class="co"># &lt;NA&gt; R - - - -</span></a>
<a class="sourceLine" id="cb11-13" data-line-number="13"><span class="co"># S or I &lt;NA&gt; X X - -</span></a>
<a class="sourceLine" id="cb11-14" data-line-number="14"><span class="co"># R &lt;NA&gt; - - - -</span></a>
<a class="sourceLine" id="cb11-15" data-line-number="15"><span class="co"># &lt;NA&gt; &lt;NA&gt; - - - -</span></a>
<a class="sourceLine" id="cb11-16" data-line-number="16"><span class="co"># --------------------------------------------------------------------</span></a></code></pre></div>
Since this is a major change, usage of the old <code>also_single_tested</code> will throw an informative error that it has been replaced by <code>only_all_tested</code>.</li>
<li>
<p><code>tibble</code> printing support for classes <code>rsi</code>, <code>mic</code>, <code>disk</code>, <code>ab</code> <code>mo</code>. When using <code>tibble</code>s containing antimicrobial columns, values <code>S</code> will print in green, values <code>I</code> will print in yellow and values <code>R</code> will print in red. Microbial IDs (class <code>mo</code>) will emphasise on the genus and species, not on the kingdom.</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="co"># (run this on your own console, as this page does not support colour printing)</span></a>
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb11-3" data-line-number="3">example_isolates <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb11-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(mo<span class="op">:</span>AMC) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb11-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/reexports.html">as_tibble</a></span>()</a></code></pre></div>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1"><span class="co"># (run this on your own console, as this page does not support colour printing)</span></a>
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb12-3" data-line-number="3">example_isolates <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb12-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(mo<span class="op">:</span>AMC) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb12-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/reexports.html">as_tibble</a></span>()</a></code></pre></div>
</li>
</ul>
</div>
@ -547,14 +560,14 @@ Since this is a major change, usage of the old <code>also_single_tested</code> w
<ul>
<li>
<p>Function <code><a href="../reference/proportion.html">rsi_df()</a></code> to transform a <code>data.frame</code> to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions <code><a href="../reference/count.html">count_df()</a></code> and <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> to immediately show resistance percentages and number of available isolates:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(AMX, CIP) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb12-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/proportion.html">rsi_df</a></span>()</a>
<a class="sourceLine" id="cb12-4" data-line-number="4"><span class="co"># antibiotic interpretation value isolates</span></a>
<a class="sourceLine" id="cb12-5" data-line-number="5"><span class="co"># 1 Amoxicillin SI 0.4442636 546</span></a>
<a class="sourceLine" id="cb12-6" data-line-number="6"><span class="co"># 2 Amoxicillin R 0.5557364 683</span></a>
<a class="sourceLine" id="cb12-7" data-line-number="7"><span class="co"># 3 Ciprofloxacin SI 0.8381831 1181</span></a>
<a class="sourceLine" id="cb12-8" data-line-number="8"><span class="co"># 4 Ciprofloxacin R 0.1618169 228</span></a></code></pre></div>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(AMX, CIP) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb13-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/proportion.html">rsi_df</a></span>()</a>
<a class="sourceLine" id="cb13-4" data-line-number="4"><span class="co"># antibiotic interpretation value isolates</span></a>
<a class="sourceLine" id="cb13-5" data-line-number="5"><span class="co"># 1 Amoxicillin SI 0.4442636 546</span></a>
<a class="sourceLine" id="cb13-6" data-line-number="6"><span class="co"># 2 Amoxicillin R 0.5557364 683</span></a>
<a class="sourceLine" id="cb13-7" data-line-number="7"><span class="co"># 3 Ciprofloxacin SI 0.8381831 1181</span></a>
<a class="sourceLine" id="cb13-8" data-line-number="8"><span class="co"># 4 Ciprofloxacin R 0.1618169 228</span></a></code></pre></div>
</li>
<li>
<p>Support for all scientifically published pathotypes of <em>E. coli</em> to date (that we could find). Supported are:</p>
@ -572,12 +585,12 @@ Since this is a major change, usage of the old <code>also_single_tested</code> w
<li>UPEC (Uropathogenic <em>E. coli</em>)</li>
</ul>
<p>All these lead to the microbial ID of <em>E. coli</em>:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="co"># B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb13-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb13-4" data-line-number="4"><span class="co"># "Escherichia coli"</span></a>
<a class="sourceLine" id="cb13-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"EHEC"</span>)</a>
<a class="sourceLine" id="cb13-6" data-line-number="6"><span class="co"># "Gram-negative"</span></a></code></pre></div>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb14-2" data-line-number="2"><span class="co"># B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb14-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb14-4" data-line-number="4"><span class="co"># "Escherichia coli"</span></a>
<a class="sourceLine" id="cb14-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"EHEC"</span>)</a>
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="co"># "Gram-negative"</span></a></code></pre></div>
</li>
<li>Function <code><a href="../reference/mo_property.html">mo_info()</a></code> as an analogy to <code><a href="../reference/ab_property.html">ab_info()</a></code>. The <code><a href="../reference/mo_property.html">mo_info()</a></code> prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism</li>
<li><p>Function <code><a href="../reference/mo_property.html">mo_synonyms()</a></code> to get all previously accepted taxonomic names of a microorganism</p></li>
@ -676,14 +689,14 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Tra
<li>when all values are unique it now shows a message instead of a warning</li>
<li>
<p>support for boxplots:</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</a>
<a class="sourceLine" id="cb14-4" data-line-number="4"><span class="co"># grouped boxplots:</span></a>
<a class="sourceLine" id="cb14-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</a></code></pre></div>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb15-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</a>
<a class="sourceLine" id="cb15-4" data-line-number="4"><span class="co"># grouped boxplots:</span></a>
<a class="sourceLine" id="cb15-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb15-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb15-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb15-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</a></code></pre></div>
</li>
</ul>
</li>
@ -768,32 +781,32 @@ This data is updated annually - check the included version with the new function
</li>
<li>
<p>New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1"><span class="kw"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()</a>
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="kw"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span>()</a>
<a class="sourceLine" id="cb15-3" data-line-number="3"><span class="kw"><a href="../reference/filter_ab_class.html">filter_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb15-4" data-line-number="4"><span class="kw"><a href="../reference/filter_ab_class.html">filter_1st_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb15-5" data-line-number="5"><span class="kw"><a href="../reference/filter_ab_class.html">filter_2nd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb15-6" data-line-number="6"><span class="kw"><a href="../reference/filter_ab_class.html">filter_3rd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb15-7" data-line-number="7"><span class="kw"><a href="../reference/filter_ab_class.html">filter_4th_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb15-8" data-line-number="8"><span class="kw"><a href="../reference/filter_ab_class.html">filter_fluoroquinolones</a></span>()</a>
<a class="sourceLine" id="cb15-9" data-line-number="9"><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>()</a>
<a class="sourceLine" id="cb15-10" data-line-number="10"><span class="kw"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span>()</a>
<a class="sourceLine" id="cb15-11" data-line-number="11"><span class="kw"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()</a></code></pre></div>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1"><span class="kw"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()</a>
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="kw"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span>()</a>
<a class="sourceLine" id="cb16-3" data-line-number="3"><span class="kw"><a href="../reference/filter_ab_class.html">filter_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb16-4" data-line-number="4"><span class="kw"><a href="../reference/filter_ab_class.html">filter_1st_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb16-5" data-line-number="5"><span class="kw"><a href="../reference/filter_ab_class.html">filter_2nd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb16-6" data-line-number="6"><span class="kw"><a href="../reference/filter_ab_class.html">filter_3rd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb16-7" data-line-number="7"><span class="kw"><a href="../reference/filter_ab_class.html">filter_4th_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb16-8" data-line-number="8"><span class="kw"><a href="../reference/filter_ab_class.html">filter_fluoroquinolones</a></span>()</a>
<a class="sourceLine" id="cb16-9" data-line-number="9"><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>()</a>
<a class="sourceLine" id="cb16-10" data-line-number="10"><span class="kw"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span>()</a>
<a class="sourceLine" id="cb16-11" data-line-number="11"><span class="kw"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()</a></code></pre></div>
<p>The <code>antibiotics</code> data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the <code>antibiotics</code> data set. For example:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>)</a>
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span></a>
<a class="sourceLine" id="cb16-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>, <span class="dt">scope =</span> <span class="st">"all"</span>)</a>
<a class="sourceLine" id="cb16-4" data-line-number="4"><span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span></a></code></pre></div>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>)</a>
<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span></a>
<a class="sourceLine" id="cb17-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>, <span class="dt">scope =</span> <span class="st">"all"</span>)</a>
<a class="sourceLine" id="cb17-4" data-line-number="4"><span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span></a></code></pre></div>
</li>
<li>
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" data-line-number="1">ab_property -&gt;<span class="st"> </span><span class="kw">atc_property</span>()</a>
<a class="sourceLine" id="cb17-2" data-line-number="2">ab_name -&gt;<span class="st"> </span><span class="kw">atc_name</span>()</a>
<a class="sourceLine" id="cb17-3" data-line-number="3">ab_official -&gt;<span class="st"> </span><span class="kw">atc_official</span>()</a>
<a class="sourceLine" id="cb17-4" data-line-number="4">ab_trivial_nl -&gt;<span class="st"> </span><span class="kw">atc_trivial_nl</span>()</a>
<a class="sourceLine" id="cb17-5" data-line-number="5">ab_certe -&gt;<span class="st"> </span><span class="kw">atc_certe</span>()</a>
<a class="sourceLine" id="cb17-6" data-line-number="6">ab_umcg -&gt;<span class="st"> </span><span class="kw">atc_umcg</span>()</a>
<a class="sourceLine" id="cb17-7" data-line-number="7">ab_tradenames -&gt;<span class="st"> </span><span class="kw">atc_tradenames</span>()</a></code></pre></div>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">ab_property -&gt;<span class="st"> </span><span class="kw">atc_property</span>()</a>
<a class="sourceLine" id="cb18-2" data-line-number="2">ab_name -&gt;<span class="st"> </span><span class="kw">atc_name</span>()</a>
<a class="sourceLine" id="cb18-3" data-line-number="3">ab_official -&gt;<span class="st"> </span><span class="kw">atc_official</span>()</a>
<a class="sourceLine" id="cb18-4" data-line-number="4">ab_trivial_nl -&gt;<span class="st"> </span><span class="kw">atc_trivial_nl</span>()</a>
<a class="sourceLine" id="cb18-5" data-line-number="5">ab_certe -&gt;<span class="st"> </span><span class="kw">atc_certe</span>()</a>
<a class="sourceLine" id="cb18-6" data-line-number="6">ab_umcg -&gt;<span class="st"> </span><span class="kw">atc_umcg</span>()</a>
<a class="sourceLine" id="cb18-7" data-line-number="7">ab_tradenames -&gt;<span class="st"> </span><span class="kw">atc_tradenames</span>()</a></code></pre></div>
These functions use <code>as.atc()</code> internally. The old <code>atc_property</code> has been renamed <code><a href="../reference/atc_online.html">atc_online_property()</a></code>. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class <code>atc</code> or must be coerable to this class. Properties of these classes should start with the same class name, analogous to <code><a href="../reference/as.mo.html">as.mo()</a></code> and e.g. <code>mo_genus</code>.</li>
<li>New functions <code><a href="../reference/mo_source.html">set_mo_source()</a></code> and <code><a href="../reference/mo_source.html">get_mo_source()</a></code> to use your own predefined MO codes as input for <code><a href="../reference/as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions</li>
<li>Support for the upcoming <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
@ -805,20 +818,20 @@ These functions use <code>as.atc()</code> internally. The old <code>atc_property
<li>New function <code><a href="../reference/age_groups.html">age_groups()</a></code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</li>
<li>
<p>New function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><a href="https://rdrr.io/r/graphics/plot.html">plot()</a></code> function can now be used for resistance prediction calculated with <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(septic_patients, <span class="dt">col_ab =</span> <span class="st">"amox"</span>)</a>
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(x)</a>
<a class="sourceLine" id="cb18-3" data-line-number="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(x)</a></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" data-line-number="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(septic_patients, <span class="dt">col_ab =</span> <span class="st">"amox"</span>)</a>
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(x)</a>
<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(x)</a></code></pre></div>
</li>
<li>
<p>Functions <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><a href="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(...)</a>
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="co"># or</span></a>
<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients, ...)</a></code></pre></div>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(...)</a>
<a class="sourceLine" id="cb20-2" data-line-number="2"><span class="co"># or</span></a>
<a class="sourceLine" id="cb20-3" data-line-number="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients, ...)</a></code></pre></div>
<p>is equal to:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb20-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb20-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb20-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb21-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb21-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
</li>
<li>New function <code><a href="../reference/availability.html">availability()</a></code> to check the number of available (non-empty) results in a <code>data.frame</code>
</li>
@ -847,33 +860,33 @@ These functions use <code>as.atc()</code> internally. The old <code>atc_property
<ul>
<li>
<p>Now handles incorrect spelling, like <code>i</code> instead of <code>y</code> and <code>f</code> instead of <code>ph</code>:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1"><span class="co"># mo_fullname() uses as.mo() internally</span></a>
<a class="sourceLine" id="cb21-2" data-line-number="2"></a>
<a class="sourceLine" id="cb21-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Sthafilokockus aaureuz"</span>)</a>
<a class="sourceLine" id="cb21-4" data-line-number="4"><span class="co">#&gt; [1] "Staphylococcus aureus"</span></a>
<a class="sourceLine" id="cb21-5" data-line-number="5"></a>
<a class="sourceLine" id="cb21-6" data-line-number="6"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. klossi"</span>)</a>
<a class="sourceLine" id="cb21-7" data-line-number="7"><span class="co">#&gt; [1] "Staphylococcus kloosii"</span></a></code></pre></div>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="co"># mo_fullname() uses as.mo() internally</span></a>
<a class="sourceLine" id="cb22-2" data-line-number="2"></a>
<a class="sourceLine" id="cb22-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Sthafilokockus aaureuz"</span>)</a>
<a class="sourceLine" id="cb22-4" data-line-number="4"><span class="co">#&gt; [1] "Staphylococcus aureus"</span></a>
<a class="sourceLine" id="cb22-5" data-line-number="5"></a>
<a class="sourceLine" id="cb22-6" data-line-number="6"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. klossi"</span>)</a>
<a class="sourceLine" id="cb22-7" data-line-number="7"><span class="co">#&gt; [1] "Staphylococcus kloosii"</span></a></code></pre></div>
</li>
<li>
<p>Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default <code>allow_uncertain = TRUE</code> is equal to uncertainty level 2. Run <code><a href="../reference/as.mo.html">?as.mo</a></code> for more info about these levels.</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="co"># equal:</span></a>
<a class="sourceLine" id="cb22-2" data-line-number="2"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb22-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb22-4" data-line-number="4"></a>
<a class="sourceLine" id="cb22-5" data-line-number="5"><span class="co"># also equal:</span></a>
<a class="sourceLine" id="cb22-6" data-line-number="6"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb22-7" data-line-number="7"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">0</span>)</a></code></pre></div>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" data-line-number="1"><span class="co"># equal:</span></a>
<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb23-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb23-4" data-line-number="4"></a>
<a class="sourceLine" id="cb23-5" data-line-number="5"><span class="co"># also equal:</span></a>
<a class="sourceLine" id="cb23-6" data-line-number="6"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb23-7" data-line-number="7"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">0</span>)</a></code></pre></div>
Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a></code> could lead to very unreliable results.</li>
<li>Implemented the latest publication of Becker <em>et al.</em> (2019), for categorising coagulase-negative <em>Staphylococci</em>
</li>
<li>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code>clean_mo_history()</code> to delete this file, which resets the algorithms.</li>
<li>
<p>Incoercible results will now be considered unknown, MO code <code>UNKNOWN</code>. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb23-3" data-line-number="3"><span class="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<a class="sourceLine" id="cb23-4" data-line-number="4"><span class="co">#&gt; [1] "(género desconocido)"</span></a></code></pre></div>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb24-3" data-line-number="3"><span class="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<a class="sourceLine" id="cb24-4" data-line-number="4"><span class="co">#&gt; [1] "(género desconocido)"</span></a></code></pre></div>
</li>
<li>Fix for vector containing only empty values</li>
<li>Finds better results when input is in other languages</li>
@ -919,19 +932,19 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<ul>
<li>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" data-line-number="1"><span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="co"># OLD WAY</span></a>
<a class="sourceLine" id="cb24-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb24-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">genus =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb24-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(genus)</a>
<a class="sourceLine" id="cb24-6" data-line-number="6"><span class="co"># NEW WAY</span></a>
<a class="sourceLine" id="cb24-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb24-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a>
<a class="sourceLine" id="cb24-9" data-line-number="9"></a>
<a class="sourceLine" id="cb24-10" data-line-number="10"><span class="co"># Even supports grouping variables:</span></a>
<a class="sourceLine" id="cb24-11" data-line-number="11">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb24-12" data-line-number="12"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(gender) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb24-13" data-line-number="13"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a></code></pre></div>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" data-line-number="1"><span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="co"># OLD WAY</span></a>
<a class="sourceLine" id="cb25-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb25-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">genus =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb25-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(genus)</a>
<a class="sourceLine" id="cb25-6" data-line-number="6"><span class="co"># NEW WAY</span></a>
<a class="sourceLine" id="cb25-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb25-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a>
<a class="sourceLine" id="cb25-9" data-line-number="9"></a>
<a class="sourceLine" id="cb25-10" data-line-number="10"><span class="co"># Even supports grouping variables:</span></a>
<a class="sourceLine" id="cb25-11" data-line-number="11">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb25-12" data-line-number="12"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(gender) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb25-13" data-line-number="13"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a></code></pre></div>
</li>
<li>Header info is now available as a list, with the <code>header</code> function</li>
<li>The parameter <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</li>
@ -1006,10 +1019,10 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Fewer than 3 characters as input for <code>as.mo</code> will return NA</li>
<li>
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb25-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb25-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb26-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb26-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
</li>
<li>Added parameter <code>combine_IR</code> (TRUE/FALSE) to functions <code>portion_df</code> and <code>count_df</code>, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</li>
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
@ -1022,15 +1035,15 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<ul>
<li>
<p>Support for grouping variables, test with:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(gender)</a></code></pre></div>
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(gender)</a></code></pre></div>
</li>
<li>
<p>Support for (un)selecting columns:</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb28-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb28-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
</li>
<li>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code>
</li>
@ -1110,18 +1123,18 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
</ul>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb28-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
<a class="sourceLine" id="cb28-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb28-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
<a class="sourceLine" id="cb28-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb28-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
<a class="sourceLine" id="cb28-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb28-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb29-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
<a class="sourceLine" id="cb29-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb29-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
<a class="sourceLine" id="cb29-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb29-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb30-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
<a class="sourceLine" id="cb30-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
<a class="sourceLine" id="cb30-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
</li>
<li>Functions <code>count_R</code>, <code>count_IR</code>, <code>count_I</code>, <code>count_SI</code> and <code>count_S</code> to selectively count resistant or susceptible isolates
<ul>
@ -1132,18 +1145,18 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using intelligent rules:</p>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb30-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb30-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb30-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb30-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
<a class="sourceLine" id="cb30-5" data-line-number="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb30-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb31-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb31-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb31-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb31-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
<a class="sourceLine" id="cb31-5" data-line-number="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb31-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb31-1" data-line-number="1">thousands_of_E_colis &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
<a class="sourceLine" id="cb31-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb31-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
<a class="sourceLine" id="cb31-4" data-line-number="4"><span class="co"># min median max neval</span></a>
<a class="sourceLine" id="cb31-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb32-1" data-line-number="1">thousands_of_E_colis &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
<a class="sourceLine" id="cb32-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb32-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
<a class="sourceLine" id="cb32-4" data-line-number="4"><span class="co"># min median max neval</span></a>
<a class="sourceLine" id="cb32-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
</li>
<li>Added parameter <code>reference_df</code> for <code>as.mo</code>, so users can supply their own microbial IDs, name or codes as a reference table</li>
<li>Renamed all previous references to <code>bactid</code> to <code>mo</code>, like:
@ -1171,12 +1184,12 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
<li>
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb32-1" data-line-number="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
<a class="sourceLine" id="cb32-3" data-line-number="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb32-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
<a class="sourceLine" id="cb32-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb32-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb33-1" data-line-number="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
<a class="sourceLine" id="cb33-3" data-line-number="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb33-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
<a class="sourceLine" id="cb33-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb33-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
</li>
<li>For <code>first_isolate</code>, rows will be ignored when theres no species available</li>
<li>Function <code>ratio</code> is now deprecated and will be removed in a future release, as it is not really the scope of this package</li>
@ -1187,13 +1200,13 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Support for quasiquotation in the functions series <code>count_*</code> and <code>portions_*</code>, and <code>n_rsi</code>. This allows to check for more than 2 vectors or columns.</p>
<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb33-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
<a class="sourceLine" id="cb33-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
<a class="sourceLine" id="cb33-4" data-line-number="4"></a>
<a class="sourceLine" id="cb33-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl)</a>
<a class="sourceLine" id="cb33-6" data-line-number="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl, gent)</a>
<a class="sourceLine" id="cb33-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
<div class="sourceCode" id="cb34"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb34-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
<a class="sourceLine" id="cb34-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
<a class="sourceLine" id="cb34-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
<a class="sourceLine" id="cb34-4" data-line-number="4"></a>
<a class="sourceLine" id="cb34-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl)</a>
<a class="sourceLine" id="cb34-6" data-line-number="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl, gent)</a>
<a class="sourceLine" id="cb34-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
</li>
<li>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</li>
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
@ -1207,12 +1220,12 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<div class="sourceCode" id="cb34"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb34-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/with.html">with</a></span>(septic_patients, <span class="kw"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb34-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(my_matrix)</a></code></pre></div>
<div class="sourceCode" id="cb35"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb35-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/with.html">with</a></span>(septic_patients, <span class="kw"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb35-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(my_matrix)</a></code></pre></div>
<p>For lists, subsetting is possible:</p>
<div class="sourceCode" id="cb35"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb35-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
<a class="sourceLine" id="cb35-2" data-line-number="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age)</a>
<a class="sourceLine" id="cb35-3" data-line-number="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(gender)</a></code></pre></div>
<div class="sourceCode" id="cb36"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb36-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
<a class="sourceLine" id="cb36-2" data-line-number="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(age)</a>
<a class="sourceLine" id="cb36-3" data-line-number="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(gender)</a></code></pre></div>
</li>
</ul>
</div>
@ -1446,7 +1459,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0-9-0-9015">0.9.0.9015</a></li>
<li><a href="#amr-0-9-0-9016">0.9.0.9016</a></li>
<li><a href="#amr-0-9-0">0.9.0</a></li>
<li><a href="#amr-0-8-0">0.8.0</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li>

View File

@ -85,7 +85,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="Latest development version">0.9.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -407,10 +407,11 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<span class='fu'>as.mo</span>(<span class='st'>"Staphylococcus aureus"</span>)
<span class='fu'>as.mo</span>(<span class='st'>"Staphylococcus aureus (MRSA)"</span>)
<span class='fu'>as.mo</span>(<span class='st'>"Zthafilokkoockus oureuz"</span>) <span class='co'># handles incorrect spelling</span>
<span class='fu'>as.mo</span>(<span class='st'>"MRSA"</span>) <span class='co'># Methicillin Resistant S. aureus</span>
<span class='fu'>as.mo</span>(<span class='st'>"VISA"</span>) <span class='co'># Vancomycin Intermediate S. aureus</span>
<span class='fu'>as.mo</span>(<span class='st'>"VRSA"</span>) <span class='co'># Vancomycin Resistant S. aureus</span>
<span class='fu'>as.mo</span>(<span class='fl'>22242419</span>) <span class='co'># Catalogue of Life ID</span>
<span class='fu'>as.mo</span>(<span class='st'>"MRSA"</span>) <span class='co'># Methicillin Resistant S. aureus</span>
<span class='fu'>as.mo</span>(<span class='st'>"VISA"</span>) <span class='co'># Vancomycin Intermediate S. aureus</span>
<span class='fu'>as.mo</span>(<span class='st'>"VRSA"</span>) <span class='co'># Vancomycin Resistant S. aureus</span>
<span class='fu'>as.mo</span>(<span class='fl'>22242419</span>) <span class='co'># Catalogue of Life ID</span>
<span class='fu'>as.mo</span>(<span class='fl'>115329001</span>) <span class='co'># SNOMED CT code</span>
<span class='co'># Dyslexia is no problem - these all work:</span>
<span class='fu'>as.mo</span>(<span class='st'>"Ureaplasma urealyticum"</span>)

View File

@ -85,7 +85,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="Latest development version">0.9.0.9014</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>

View File

@ -85,7 +85,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="Latest development version">0.9.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -252,7 +252,7 @@
<li><p><code>gender</code><br /> gender of the patient</p></li>
<li><p><code>patient_id</code><br /> ID of the patient</p></li>
<li><p><code>mo</code><br /> ID of microorganism created with <code><a href='as.mo.html'>as.mo()</a></code>, see also <a href='microorganisms.html'>microorganisms</a></p></li>
<li><p><code>PEN:RIF</code><br /> 40 different antibiotics with class <code><a href='as.rsi.html'>rsi</a></code> (see <code><a href='as.rsi.html'>as.rsi()</a></code>); these column names occur in <a href='antibiotics.html'>antibiotics</a> data set and can be translated with <code><a href='ab_property.html'>ab_name()</a></code></p></li>
<li><p><code>PEN:RIF</code><br /> 40 different antibiotics with class <code><a href='as.rsi.html'>rsi</a></code> (see <code><a href='as.rsi.html'>as.rsi()</a></code>); these column names occur in the <a href='antibiotics.html'>antibiotics</a> data set and can be translated with <code><a href='ab_property.html'>ab_name()</a></code></p></li>
</ul>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>

View File

@ -84,7 +84,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="Latest development version">0.9.0.9015</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -304,7 +304,7 @@
<td>
<p><code><a href="rsi_translation.html">rsi_translation</a></code> </p>
</td>
<td><p>Data set for RSI interpretation</p></td>
<td><p>Data set for R/SI interpretation</p></td>
</tr>
</tbody><tbody>
<tr>
@ -364,7 +364,7 @@
</tr><tr>
<td>
<p><code><a href="mo_property.html">mo_name()</a></code> <code><a href="mo_property.html">mo_fullname()</a></code> <code><a href="mo_property.html">mo_shortname()</a></code> <code><a href="mo_property.html">mo_subspecies()</a></code> <code><a href="mo_property.html">mo_species()</a></code> <code><a href="mo_property.html">mo_genus()</a></code> <code><a href="mo_property.html">mo_family()</a></code> <code><a href="mo_property.html">mo_order()</a></code> <code><a href="mo_property.html">mo_class()</a></code> <code><a href="mo_property.html">mo_phylum()</a></code> <code><a href="mo_property.html">mo_kingdom()</a></code> <code><a href="mo_property.html">mo_type()</a></code> <code><a href="mo_property.html">mo_gramstain()</a></code> <code><a href="mo_property.html">mo_ref()</a></code> <code><a href="mo_property.html">mo_authors()</a></code> <code><a href="mo_property.html">mo_year()</a></code> <code><a href="mo_property.html">mo_rank()</a></code> <code><a href="mo_property.html">mo_taxonomy()</a></code> <code><a href="mo_property.html">mo_synonyms()</a></code> <code><a href="mo_property.html">mo_info()</a></code> <code><a href="mo_property.html">mo_url()</a></code> <code><a href="mo_property.html">mo_property()</a></code> </p>
<p><code><a href="mo_property.html">mo_name()</a></code> <code><a href="mo_property.html">mo_fullname()</a></code> <code><a href="mo_property.html">mo_shortname()</a></code> <code><a href="mo_property.html">mo_subspecies()</a></code> <code><a href="mo_property.html">mo_species()</a></code> <code><a href="mo_property.html">mo_genus()</a></code> <code><a href="mo_property.html">mo_family()</a></code> <code><a href="mo_property.html">mo_order()</a></code> <code><a href="mo_property.html">mo_class()</a></code> <code><a href="mo_property.html">mo_phylum()</a></code> <code><a href="mo_property.html">mo_kingdom()</a></code> <code><a href="mo_property.html">mo_type()</a></code> <code><a href="mo_property.html">mo_gramstain()</a></code> <code><a href="mo_property.html">mo_snomed()</a></code> <code><a href="mo_property.html">mo_ref()</a></code> <code><a href="mo_property.html">mo_authors()</a></code> <code><a href="mo_property.html">mo_year()</a></code> <code><a href="mo_property.html">mo_rank()</a></code> <code><a href="mo_property.html">mo_taxonomy()</a></code> <code><a href="mo_property.html">mo_synonyms()</a></code> <code><a href="mo_property.html">mo_info()</a></code> <code><a href="mo_property.html">mo_url()</a></code> <code><a href="mo_property.html">mo_property()</a></code> </p>
</td>
<td><p>Property of a microorganism</p></td>
</tr><tr>

View File

@ -85,7 +85,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="Latest development version">0.9.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -242,7 +242,7 @@
<h2 class="hasAnchor" id="format"><a class="anchor" href="#format"></a>Format</h2>
<p>A <code><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></code> with 69,447 observations and 16 variables:</p><ul>
<p>A <code><a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a></code> with 69,447 observations and 17 variables:</p><ul>
<li><p><code>mo</code><br /> ID of microorganism as used by this package</p></li>
<li><p><code>col_id</code><br /> Catalogue of Life ID</p></li>
<li><p><code>fullname</code><br /> Full name, like <code>"Escherichia coli"</code></p></li>
@ -252,6 +252,7 @@
<li><p><code>species_id</code><br /> ID of the species as used by the Catalogue of Life</p></li>
<li><p><code>source</code><br /> Either "CoL", "DSMZ" (see Source) or "manually added"</p></li>
<li><p><code>prevalence</code><br /> Prevalence of the microorganism, see <code><a href='as.mo.html'>as.mo()</a></code></p></li>
<li><p><code>snomed</code><br /> SNOMED code of the microorganism. Use <code><a href='mo_property.html'>mo_snomed()</a></code> to retrieve it quickly, see <code><a href='mo_property.html'>mo_property()</a></code>.</p></li>
</ul>
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>

View File

@ -85,7 +85,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="Latest development version">0.9.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -263,6 +263,8 @@
<span class='fu'>mo_gramstain</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_snomed</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>mo_ref</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>mo_authors</span>(<span class='no'>x</span>, <span class='no'>...</span>)
@ -313,6 +315,7 @@
<li><p>An <code><a href='https://rdrr.io/r/base/integer.html'>integer</a></code> in case of <code>mo_year()</code></p></li>
<li><p>A <code><a href='https://rdrr.io/r/base/list.html'>list</a></code> in case of <code>mo_taxonomy()</code> and <code>mo_info()</code></p></li>
<li><p>A named <code><a href='https://rdrr.io/r/base/character.html'>character</a></code> in case of <code>mo_url()</code></p></li>
<li><p>A <code><a href='https://rdrr.io/r/base/double.html'>double</a></code> in case of <code>mo_snomed()</code></p></li>
<li><p>A <code><a href='https://rdrr.io/r/base/character.html'>character</a></code> in all other cases</p></li>
</ul>
@ -367,11 +370,12 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<span class='co'># colloquial properties ----------------------------------------------------</span>
<span class='fu'>mo_name</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli"</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli", same as mo_name()</span>
<span class='fu'>mo_fullname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Escherichia coli" - same as mo_name()</span>
<span class='fu'>mo_shortname</span>(<span class='st'>"E. coli"</span>) <span class='co'># "E. coli"</span>
<span class='co'># other properties ---------------------------------------------------------</span>
<span class='fu'>mo_gramstain</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Gram-negative"</span>
<span class='fu'>mo_snomed</span>(<span class='st'>"E. coli"</span>) <span class='co'># 112283007, 116395006, ... (SNOMED codes)</span>
<span class='fu'>mo_type</span>(<span class='st'>"E. coli"</span>) <span class='co'># "Bacteria" (equal to kingdom, but may be translated)</span>
<span class='fu'>mo_rank</span>(<span class='st'>"E. coli"</span>) <span class='co'># "species"</span>
<span class='fu'>mo_url</span>(<span class='st'>"E. coli"</span>) <span class='co'># get the direct url to the online database entry</span>

View File

@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data set for RSI interpretation — rsi_translation • AMR (for R)</title>
<title>Data set for R/SI interpretation — rsi_translation • AMR (for R)</title>
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
@ -50,8 +50,8 @@
<link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script>
<meta property="og:title" content="Data set for RSI interpretation — rsi_translation" />
<meta property="og:description" content="Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use as.rsi() to transform MICs or disks measurements to RSI values." />
<meta property="og:title" content="Data set for R/SI interpretation — rsi_translation" />
<meta property="og:description" content="Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use as.rsi() to transform MICs or disks measurements to R/SI values." />
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" />
<meta name="twitter:card" content="summary" />
@ -85,7 +85,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="Latest development version">0.9.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9016</span>
</span>
</div>
@ -228,13 +228,13 @@
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Data set for RSI interpretation</h1>
<h1>Data set for R/SI interpretation</h1>
<div class="hidden name"><code>rsi_translation.Rd</code></div>
</div>
<div class="ref-description">
<p>Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use <code><a href='as.rsi.html'>as.rsi()</a></code> to transform MICs or disks measurements to RSI values.</p>
<p>Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use <code><a href='as.rsi.html'>as.rsi()</a></code> to transform MICs or disks measurements to R/SI values.</p>
</div>
<pre class="usage"><span class='no'>rsi_translation</span></pre>
@ -253,6 +253,9 @@
<li><p><code>breakpoint_S</code><br /> Lowest MIC value or highest number of millimeters that leads to "S"</p></li>
<li><p><code>breakpoint_R</code><br /> Highest MIC value or lowest number of millimeters that leads to "R"</p></li>
</ul>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>The repository of this <code>AMR</code> package contains a file comprising this exact data set: https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt. This file <strong>allows for machine reading EUCAST and CLSI guidelines</strong>, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.</p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
@ -264,6 +267,7 @@
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#format">Format</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#read-more-on-our-website-">Read more on our website!</a></li>
</ul>

View File

@ -10,7 +10,7 @@
`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. **Our aim is to provide a standard** for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC and LOINC), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
After installing this package, R knows [**~70,000 distinct microbial species**](./reference/microorganisms.html) and all [**~550 antibiotic, antimycotic and antiviral drugs**](./reference/antibiotics.html) by name and code (including ATC, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
We created this package for both routine data analysis and academic research (as part of our PhD theses) at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is [actively maintained](./news) and is free software (see [Copyright](#copyright)).
@ -48,36 +48,25 @@ This package can be used for:
* Getting properties for any antibiotic (like name, EARS-Net code, ATC code, PubChem code, defined daily dose or trade name) ([manual](./reference/ab_property.html))
* Plotting antimicrobial resistance ([tutorial](./articles/AMR.html))
* Applying EUCAST expert rules ([manual](./reference/eucast_rules.html))
* Getting SNOMED codes of a microorganism, or get its name associated with a SNOMED code ([manual](./reference/mo_property.html))
* Getting LOINC codes of an antibiotic, or get its name associated with a LOINC code ([manual](./reference/ab_property.html))
* Machine reading the EUCAST and CLSI guidelines from 2011-2019 to translate MIC values and disk diffusion diameters to R/SI ([link](https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt))
This package is ready-to-use for a professional environment by specialists in the following fields:
Medical Microbiology
This package is ready-to-use for specialists in many fields:
* Epidemiologists (both clinical microbiological and research)
* Research Microbiologists
* (Research) Microbiologists
* Biomedical Researchers
* Research Pharmacologists
* Data Scientists / Data Analysts
Veterinary Microbiology
* Statisticians
* Bioinformaticians
* Research Veterinarians
* Veterinary Epidemiologists
Microbial Ecology
* Soil Microbiologists
* Extremophile Researchers
* Astrobiologists
Developers
* Package developers for R
* Software developers
* Web application / Shiny developers
### Get this package
#### Latest released version
@ -143,8 +132,8 @@ The `AMR` package basically does four important things:
* Use `first_isolate()` to identify the first isolates of every patient [using guidelines from the CLSI](https://clsi.org/standards/products/microbiology/documents/m39/) (Clinical and Laboratory Standards Institute).
* You can also identify first *weighted* isolates of every patient, an adjusted version of the CLSI guideline. This takes into account key antibiotics of every strain and compares them.
* Use `mdro()` 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 *et al.* (2012, [PMID 21793988](https://www.ncbi.nlm.nih.gov/pubmed/?term=21793988)), 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.
* The [data set microorganisms](./reference/microorganisms.html) 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 `mo_genus()`, `mo_family()`, `mo_gramstain()` or even `mo_phylum()`. As they use `as.mo()` internally, they also use the same intelligent rules for determination. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
* The [data set antibiotics](./reference/antibiotics.html) contains ~450 antimicrobial drugs with their EARS-Net code, ATC code, PubChem compound ID, 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 `ab_name()`, `ab_group()`, `ab_atc()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
* The [data set microorganisms](./reference/microorganisms.html) 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 `mo_genus()`, `mo_family()`, `mo_gramstain()` or even `mo_phylum()`. Use `mo_snomed()` to look up any SNOMED CT code associated with a microorganism. As all these function use `as.mo()` internally, they also use the same intelligent rules for determination. For example, `mo_genus("MRSA")` and `mo_genus("S. aureus")` will both return `"Staphylococcus"`. They also come with support for German, Dutch, Spanish, Italian, French and Portuguese. These functions can be used to add new variables to your data.
* The [data set antibiotics](./reference/antibiotics.html) 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 `ab_name()`, `ab_group()`, `ab_atc()`, `ab_loinc()` and `ab_tradenames()` to look up values. The `ab_*` functions use `as.ab()` internally so they support the same intelligent rules to guess the most probable result. For example, `ab_name("Fluclox")`, `ab_name("Floxapen")` and `ab_name("J01CF05")` will all return `"Flucloxacillin"`. These functions can again be used to add new variables to your data.
3. It **analyses the data** with convenient functions that use well-known methods.

View File

@ -175,10 +175,11 @@ as.mo("S aureus")
as.mo("Staphylococcus aureus")
as.mo("Staphylococcus aureus (MRSA)")
as.mo("Zthafilokkoockus oureuz") # handles incorrect spelling
as.mo("MRSA") # Methicillin Resistant S. aureus
as.mo("VISA") # Vancomycin Intermediate S. aureus
as.mo("VRSA") # Vancomycin Resistant S. aureus
as.mo(22242419) # Catalogue of Life ID
as.mo("MRSA") # Methicillin Resistant S. aureus
as.mo("VISA") # Vancomycin Intermediate S. aureus
as.mo("VRSA") # Vancomycin Resistant S. aureus
as.mo(22242419) # Catalogue of Life ID
as.mo(115329001) # SNOMED CT code
# Dyslexia is no problem - these all work:
as.mo("Ureaplasma urealyticum")

View File

@ -15,7 +15,7 @@
\item \code{gender}\cr gender of the patient
\item \code{patient_id}\cr ID of the patient
\item \code{mo}\cr ID of microorganism created with \code{\link[=as.mo]{as.mo()}}, see also \link{microorganisms}
\item \code{PEN:RIF}\cr 40 different antibiotics with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}}); these column names occur in \link{antibiotics} data set and can be translated with \code{\link[=ab_name]{ab_name()}}
\item \code{PEN:RIF}\cr 40 different antibiotics with class \code{\link{rsi}} (see \code{\link[=as.rsi]{as.rsi()}}); these column names occur in the \link{antibiotics} data set and can be translated with \code{\link[=ab_name]{ab_name()}}
}}
\usage{
example_isolates

View File

@ -4,7 +4,7 @@
\name{microorganisms}
\alias{microorganisms}
\title{Data set with ~70,000 microorganisms}
\format{A \code{\link{data.frame}} with 69,447 observations and 16 variables:
\format{A \code{\link{data.frame}} with 69,447 observations and 17 variables:
\itemize{
\item \code{mo}\cr ID of microorganism as used by this package
\item \code{col_id}\cr Catalogue of Life ID
@ -15,6 +15,7 @@
\item \code{species_id}\cr ID of the species as used by the Catalogue of Life
\item \code{source}\cr Either "CoL", "DSMZ" (see Source) or "manually added"
\item \code{prevalence}\cr Prevalence of the microorganism, see \code{\link[=as.mo]{as.mo()}}
\item \code{snomed}\cr SNOMED code of the microorganism. Use \code{\link[=mo_snomed]{mo_snomed()}} to retrieve it quickly, see \code{\link[=mo_property]{mo_property()}}.
}}
\source{
Catalogue of Life: Annual Checklist (public online taxonomic database), \url{http://www.catalogueoflife.org} (check included annual version with \code{\link[=catalogue_of_life_version]{catalogue_of_life_version()}}).

View File

@ -15,6 +15,7 @@
\alias{mo_kingdom}
\alias{mo_type}
\alias{mo_gramstain}
\alias{mo_snomed}
\alias{mo_ref}
\alias{mo_authors}
\alias{mo_year}
@ -51,6 +52,8 @@ mo_type(x, language = get_locale(), ...)
mo_gramstain(x, language = get_locale(), ...)
mo_snomed(x, ...)
mo_ref(x, ...)
mo_authors(x, ...)
@ -85,6 +88,7 @@ mo_property(x, property = "fullname", language = get_locale(), ...)
\item An \code{\link{integer}} in case of \code{\link[=mo_year]{mo_year()}}
\item A \code{\link{list}} in case of \code{\link[=mo_taxonomy]{mo_taxonomy()}} and \code{\link[=mo_info]{mo_info()}}
\item A named \code{\link{character}} in case of \code{\link[=mo_url]{mo_url()}}
\item A \code{\link{double}} in case of \code{\link[=mo_snomed]{mo_snomed()}}
\item A \code{\link{character}} in all other cases
}
}
@ -141,11 +145,12 @@ mo_subspecies("E. coli") # ""
# colloquial properties ----------------------------------------------------
mo_name("E. coli") # "Escherichia coli"
mo_fullname("E. coli") # "Escherichia coli", same as mo_name()
mo_fullname("E. coli") # "Escherichia coli" - same as mo_name()
mo_shortname("E. coli") # "E. coli"
# other properties ---------------------------------------------------------
mo_gramstain("E. coli") # "Gram-negative"
mo_snomed("E. coli") # 112283007, 116395006, ... (SNOMED codes)
mo_type("E. coli") # "Bacteria" (equal to kingdom, but may be translated)
mo_rank("E. coli") # "species"
mo_url("E. coli") # get the direct url to the online database entry

View File

@ -3,7 +3,7 @@
\docType{data}
\name{rsi_translation}
\alias{rsi_translation}
\title{Data set for RSI interpretation}
\title{Data set for R/SI interpretation}
\format{A \code{\link{data.frame}} with 13,975 observations and 9 variables:
\itemize{
\item \code{guideline}\cr Name of the guideline
@ -20,7 +20,10 @@
rsi_translation
}
\description{
Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to RSI values.
Data set to interpret MIC and disk diffusion to R/SI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use \code{\link[=as.rsi]{as.rsi()}} to transform MICs or disks measurements to R/SI values.
}
\details{
The repository of this \code{AMR} package contains a file comprising this exact data set: \link{https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}. This file \strong{allows for machine reading EUCAST and CLSI guidelines}, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file is updated automatically.
}
\section{Read more on our website!}{

View File

@ -38,6 +38,7 @@ test_that("as.mo works", {
expect_equal(as.character(as.mo("Escherichia coli")), "B_ESCHR_COLI")
expect_equal(as.character(as.mo("Escherichia coli")), "B_ESCHR_COLI")
expect_equal(as.character(as.mo(22242416)), "B_ESCHR_COLI")
expect_equal(as.character(as.mo(112283007)), "B_ESCHR_COLI")
expect_equal(as.character(as.mo("Escherichia species")), "B_ESCHR")
expect_equal(as.character(as.mo("Escherichia")), "B_ESCHR")
expect_equal(as.character(as.mo("Esch spp.")), "B_ESCHR")
@ -240,7 +241,7 @@ test_that("as.mo works", {
expect_output(print(mo_uncertainties()))
# Salmonella (City) are all actually Salmonella enterica spp (City)
expect_equal(mo_name(c("Salmonella Goettingen", "Salmonella Typhimurium", "Salmonella Group A")),
expect_equal(suppressWarnings(mo_name(c("Salmonella Goettingen", "Salmonella Typhimurium", "Salmonella Group A"))),
c("Salmonella enterica", "Salmonella typhimurium", "Salmonella"))
# no virusses

View File

@ -93,6 +93,9 @@ test_that("mo_property works", {
expect_identical(suppressWarnings(mo_ref("Chlamydia psittaci")), "Page, 1968")
expect_identical(mo_ref("Chlamydophila psittaci"), "Everett et al., 1999")
expect_equal(mo_snomed("Escherichia coli"),
c(112283007, 116395006, 116396007, 103429008, 83285000, 116394005, 407166006, 457914007))
# old codes must throw a warning in mo_* family
expect_warning(mo_name(c("B_ESCHR_COL", "B_STPHY_AUR")))