* Added more antibiotic class selectors: `aminopenicillins()`, `lincosamides()`, `lipoglycopeptides()`, `polymyxins()`, `quinolones()`, `streptogramins()` and `ureidopenicillins()`
* Antibiotic class selectors (see `ab_class()`)
* They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013
* Added more selectors: `aminopenicillins()`, `lincosamides()`, `lipoglycopeptides()`, `polymyxins()`, `quinolones()`, `streptogramins()` and `ureidopenicillins()`
* Fix for using selectors multiple times in one call (e.g., using them in `dplyr::filter()` and immediately after in `dplyr::select()`)
* Added `ggplot2::autoplot()` generic for classes `<mic>`, `<disk>`, `<rsi>` and `<resistance_predict>`
* Fix to prevent introducing `NA`s for old MO codes when running `as.mo()` on them
* Added more informative error messages when any of the `proportion_*()` and `count_*()` functions fail
* Fix for using antibiotic selectors multiple times in one call (e.g., using in `dplyr::filter()` and immediately after in `dplyr::select()`)
* When printing a tibble with any old MO code, a warning will be thrown that old codes should be updated using `as.mo()`
* Improved automatic column selector when `col_*` arguments are left blank, e.g. in `first_isolate()`
* The right input types for `random_mic()`, `random_disk()` and `random_rsi()` are now enforced
#' These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
#' These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
#' @inheritSection lifecycle Stable Lifecycle
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
#' @details \strong{\Sexpr{ifelse(getRversion() < "3.2", paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
#'
#' These functions can be used in data set calls for selecting columns and filtering rows, see *Examples*. They support base R, but work more convenient in dplyr functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()].
#' @details
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
#'
#' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector such as [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the [ab_class()] function to filter/select on a manually defined antibiotic class.
#' @param ... ignored, only in place to allow future extensions
#' @details **Note:** As opposed to the `join()` functions of `dplyr`, [character] vectors are supported and at default existing columns will get a suffix `"2"` and the newly joined columns will not get a suffix.
#'
#' If the `dplyr` package is installed, their join functions will be used. Otherwise, the much slower [merge()] and [interaction()] functions from base R will be used.
#' If the `dplyr` package is installed, their join functions will be used. Otherwise, the much slower [merge()] and [interaction()] functions from base \R will be used.
#' @param ab any [character] that can be coerced to a valid antimicrobial agent code with [as.ab()]
#' @param prob_RSI a vector of length 3: the probabilities for R (1st value), S (2nd value) and I (3rd value)
#' @param ... ignored, only in place to allow future extensions
#' @details The base R function [sample()] is used for generating values.
#' @details The base \R function [sample()] is used for generating values.
#'
#' Generated values are based on the latest EUCAST guideline implemented in the [rsi_translation] data set. To create specific generated values per bug or drug, set the `mo` and/or `ab` argument.
#' @return class `<mic>` for [random_mic()] (see [as.mic()]) and class `<disk>` for [random_disk()] (see [as.disk()])
@ -56,18 +56,26 @@
@@ -56,18 +56,26 @@
#' random_disk(100, "Streptococcus pneumoniae", "ampicillin") # range 12-27
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><ahref="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><ahref="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><ahref="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><ahref="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <ahref="./reference/microorganisms.html">all microorganisms</a> and <ahref="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
<ahref="#last-updated-15-june-2021"class="anchor"></a><small>Last updated: 15 June 2021</small>
<ahref="#last-updated-22-june-2021"class="anchor"></a><small>Last updated: 22 June 2021</small>
</h2>
<divid="changed"class="section level3">
<h3class="hasAnchor">
<ahref="#changed"class="anchor"></a>Changed</h3>
<ul>
<li>Added more antibiotic class selectors: <code><ahref="../reference/antibiotic_class_selectors.html">aminopenicillins()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">lincosamides()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">lipoglycopeptides()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">polymyxins()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">quinolones()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">streptogramins()</a></code> and <code><ahref="../reference/antibiotic_class_selectors.html">ureidopenicillins()</a></code>
<li>Antibiotic class selectors (see <code><ahref="../reference/antibiotic_class_selectors.html">ab_class()</a></code>)
<ul>
<li>They now finally also work in R-3.0 and R-3.1, supporting every version of R since 2013</li>
<li>Added more selectors: <code><ahref="../reference/antibiotic_class_selectors.html">aminopenicillins()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">lincosamides()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">lipoglycopeptides()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">polymyxins()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">quinolones()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">streptogramins()</a></code> and <code><ahref="../reference/antibiotic_class_selectors.html">ureidopenicillins()</a></code>
</li>
<li>Fix for using selectors multiple times in one call (e.g., using them in <code><ahref="https://dplyr.tidyverse.org/reference/filter.html">dplyr::filter()</a></code> and immediately after in <code><ahref="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code>)</li>
</ul>
</li>
<li>Added <code><ahref="https://ggplot2.tidyverse.org/reference/autoplot.html">ggplot2::autoplot()</a></code> generic for classes <code><mic></code>, <code><disk></code>, <code><rsi></code> and <code><resistance_predict></code>
</li>
<li>Fix to prevent introducing <code>NA</code>s for old MO codes when running <code><ahref="../reference/as.mo.html">as.mo()</a></code> on them</li>
<li>Added more informative error messages when any of the <code>proportion_*()</code> and <code>count_*()</code> functions fail</li>
<li>Fix for using antibiotic selectors multiple times in one call (e.g., using in <code><ahref="https://dplyr.tidyverse.org/reference/filter.html">dplyr::filter()</a></code> and immediately after in <code><ahref="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code>)</li>
<li>When printing a tibble with any old MO code, a warning will be thrown that old codes should be updated using <code><ahref="../reference/as.mo.html">as.mo()</a></code>
</li>
<li>Improved automatic column selector when <code>col_*</code> arguments are left blank, e.g.ย in <code><ahref="../reference/first_isolate.html">first_isolate()</a></code>
</li>
<li>The right input types for <code><ahref="../reference/random.html">random_mic()</a></code>, <code><ahref="../reference/random.html">random_disk()</a></code> and <code><ahref="../reference/random.html">random_rsi()</a></code> are now enforced</li>
</ul>
</div>
</div>
@ -307,7 +317,7 @@
@@ -307,7 +317,7 @@
</ul>
</li>
<li>Function <code><ahref="../reference/antibiotic_class_selectors.html">betalactams()</a></code> as additional antbiotic column selector and function <code><ahref="../reference/AMR-deprecated.html">filter_betalactams()</a></code> as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</li>
<li>A <code>ggplot()</code> method for <code><ahref="../reference/resistance_predict.html">resistance_predict()</a></code>
<li>A <code><ahref="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> method for <code><ahref="../reference/resistance_predict.html">resistance_predict()</a></code>
</li>
</ul>
</div>
@ -408,7 +418,7 @@
@@ -408,7 +418,7 @@
<spanclass="co">#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
</li>
<li><p>Support for custom MDRO guidelines, using the new <code><ahref="../reference/mdro.html">custom_mdro_guideline()</a></code> function, please see <code><ahref="../reference/mdro.html">mdro()</a></code> for additional info</p></li>
<li><p><code>ggplot()</code> generics for classes <code><mic></code> and <code><disk></code></p></li>
<li><p><code><ahref="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> generics for classes <code><mic></code> and <code><disk></code></p></li>
<li>
<p>Function <code><ahref="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
<li>Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent</li>
<li>All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)</li>
<li>Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see <code>translate</code>)</li>
<li>Plotting is now possible with base R using <code><ahref="../reference/plot.html">plot()</a></code> and with ggplot2 using <code>ggplot()</code> on any vector of MIC and disk diffusion values</li>
<li>Plotting is now possible with base R using <code><ahref="../reference/plot.html">plot()</a></code> and with ggplot2 using <code><ahref="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> on any vector of MIC and disk diffusion values</li>
</ul>
</li>
<li>Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the <code>microorganisms</code> data set</li>
<metaproperty="og:description"content="These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations."/>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9001</span>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9005</span>
</span>
</div>
@ -240,8 +239,7 @@
@@ -240,8 +239,7 @@
</div>
<divclass="ref-description">
<p>These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. <strong>
</strong></p>
<p>These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.</p>
<p>These functions can be used in data set calls for selecting columns and filtering rows, see <em>Examples</em>. They support base R, but work more convenient in dplyr functions such as <code><ahref='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code>, <code><ahref='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> and <code><ahref='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>.</p>
<p>These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the <ahref='https://tidyselect.r-lib.org/reference/language.html'>Tidyverse selection helpers</a>, but also work in base <spanstyle="R">R</span> and not only in <code>dplyr</code> verbs. Nonetheless, they are very convenient to use with <code>dplyr</code> functions such as <code><ahref='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code>, <code><ahref='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> and <code><ahref='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>, see <em>Examples</em>.</p>
<p>All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the <ahref='antibiotics.html'>antibiotics</a> data set. This means that a selector such as <code>aminoglycosides()</code> will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the <code>ab_class()</code> function to filter/select on a manually defined antibiotic class.</p>
<h2class="hasAnchor"id="full-list-of-supported-agents"><aclass="anchor"href="#full-list-of-supported-agents"></a>Full list of supported agents</h2>
@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
@@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1</span>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9005</span>
</span>
</div>
@ -457,11 +457,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
@@ -457,11 +457,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<preclass="examples"><spanclass='co'># `example_isolates` is a data set available in the AMR package.</span>
<p><strong>Note:</strong> As opposed to the <code>join()</code> functions of <code>dplyr</code>, <ahref='https://rdrr.io/r/base/character.html'>character</a> vectors are supported and at default existing columns will get a suffix <code>"2"</code> and the newly joined columns will not get a suffix.</p>
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><ahref='https://rdrr.io/r/base/merge.html'>merge()</a></code> and <code><ahref='https://rdrr.io/r/base/interaction.html'>interaction()</a></code> functions from base R will be used.</p>
<p>If the <code>dplyr</code> package is installed, their join functions will be used. Otherwise, the much slower <code><ahref='https://rdrr.io/r/base/merge.html'>merge()</a></code> and <code><ahref='https://rdrr.io/r/base/interaction.html'>interaction()</a></code> functions from base <spanstyle="R">R</span> will be used.</p>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9002</span>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9005</span>
</span>
</div>
@ -239,7 +239,7 @@
@@ -239,7 +239,7 @@
</div>
<divclass="ref-description">
<p>Functions to plot classes <code>rsi</code>, <code>mic</code> and <code>disk</code>, with support for base R and <code>ggplot2</code>.</p>
<p>Functions to plot classes <code>rsi</code>, <code>mic</code> and <code>disk</code>, with support for base <spanstyle="R">R</span> and <code>ggplot2</code>.</p>
</div>
<preclass="usage"><spanclass='co'># S3 method for mic</span>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1</span>
<spanclass="version label label-default"data-toggle="tooltip"data-placement="bottom"title="Latest development version">1.7.1.9005</span>
</span>
</div>
@ -278,7 +278,7 @@
@@ -278,7 +278,7 @@
<p>class <code><mic></code> for <code>random_mic()</code> (see <code><ahref='as.mic.html'>as.mic()</a></code>) and class <code><disk></code> for <code>random_disk()</code> (see <code><ahref='as.disk.html'>as.disk()</a></code>)</p>
<p>The base R function <code><ahref='https://rdrr.io/r/base/sample.html'>sample()</a></code> is used for generating values.</p>
<p>The base <spanstyle="R">R</span> function <code><ahref='https://rdrr.io/r/base/sample.html'>sample()</a></code> is used for generating values.</p>
<p>Generated values are based on the latest EUCAST guideline implemented in the <ahref='rsi_translation.html'>rsi_translation</a> data set. To create specific generated values per bug or drug, set the <code>mo</code> and/or <code>ab</code> argument.</p>