@ -19,12 +19,34 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
This data is updated annually - check the included version with the new function `catalogue_of_life_version()`.
This data is updated annually - check the included version with the new function `catalogue_of_life_version()`.
* Due to this change, some `mo` codes changed (e.g. *Streptococcus* changed from `B_STRPTC` to `B_STRPT`). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
* Due to this change, some `mo` codes changed (e.g. *Streptococcus* changed from `B_STRPTC` to `B_STRPT`). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.
* New function `mo_rank()` for the taxonomic rank (genus, species, infraspecies, etc.)
* New function `mo_rank()` for the taxonomic rank (genus, species, infraspecies, etc.)
* New function `mo_url()` to get the URL to the Catalogue of Life
* New function `mo_url()` to get the direct URL of a species from the Catalogue of Life
* Support for data from [WHONET](https://whonet.org/) and [EARS-Net](https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net) (European Antimicrobial Resistance Surveillance Network):
* Support for data from [WHONET](https://whonet.org/) and [EARS-Net](https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net) (European Antimicrobial Resistance Surveillance Network):
* Exported files from WHONET can be read and used in this package. For functions like `first_isolate()` and `eucast_rules()`, all parameters will be filled in automatically.
* Exported files from WHONET can be read and used in this package. For functions like `first_isolate()` and `eucast_rules()`, all parameters will be filled in automatically.
* This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the `antibiotics` data set now contains a column `ears_net`.
* This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the `antibiotics` data set now contains a column `ears_net`.
* The function `as.mo()` now knows all WHONET species abbreviations too, because more than 1,600 microbial abbreviations were added to the `microorganisms.codes` data set.
* The function `as.mo()` now knows all WHONET species abbreviations too, because more than 1,600 microbial abbreviations were added to the `microorganisms.codes` data set.
* New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:
```r
filter_aminoglycosides()
filter_carbapenems()
filter_cephalosporins()
filter_1st_cephalosporins()
filter_2nd_cephalosporins()
filter_3rd_cephalosporins()
filter_4th_cephalosporins()
filter_fluoroquinolones()
filter_glycopeptides()
filter_macrolides()
filter_tetracyclines()
```
The `antibiotics` 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 `antibiotics` data set.
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
#' @param scope the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}
#' @param scope the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}
#' @param ... parameters passed on to \code{\link[dplyr]{filter_at}}
#' @param ... parameters passed on to \code{\link[dplyr]{filter_at}}
#' @details The \code{\code{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
#' @details The \code{\link{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
#' @rdname filter_ab_class
#' @rdname filter_ab_class
#' @keywords filter fillter_class
#' @importFrom dplyr filter_at %>% select vars any_vars all_vars
#' @importFrom dplyr filter_at %>% select vars any_vars all_vars
#' @importFrom crayon bold blue
#' @importFrom crayon bold blue
#' @export
#' @export
@ -89,7 +90,7 @@ filter_ab_class <- function(tbl,
scope_fn<-all_vars
scope_fn<-all_vars
}
}
message(blue(paste0("Filtering on ",atc_groups,": ",scope," of ",
message(blue(paste0("Filtering on ",atc_groups,": ",scope," of ",
<p>The responsible author(s) and year of scientific publication</p>
<p>The responsible author(s) and year of scientific publication</p>
This data is updated annually - check the included version with the new function <code><ahref="../reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code>.</li>
This data is updated annually - check the included version with the new function <code><ahref="../reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code>.</li>
<li>Due to this change, some <code>mo</code> codes changed (e.g.<em>Streptococcus</em> changed from <code>B_STRPTC</code> to <code>B_STRPT</code>). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.</li>
<li>Due to this change, some <code>mo</code> codes changed (e.g.<em>Streptococcus</em> changed from <code>B_STRPTC</code> to <code>B_STRPT</code>). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.</li>
<li>New function <code><ahref="../reference/mo_property.html">mo_rank()</a></code> for the taxonomic rank (genus, species, infraspecies, etc.)</li>
<li>New function <code><ahref="../reference/mo_property.html">mo_url()</a></code> to get the direct URL of a species from the Catalogue of Life</li>
</ul>
</ul>
</li>
</li>
<li>New function <code><ahref="../reference/mo_property.html">mo_rank()</a></code> for the taxonomic rank (genus, species, infraspecies, etc.)</li>
<li>New function <code><ahref="../reference/mo_property.html">mo_url()</a></code> to get the URL to the Catalogue of Life</li>
<li>Support for data from <ahref="https://whonet.org/">WHONET</a> and <ahref="https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net">EARS-Net</a> (European Antimicrobial Resistance Surveillance Network):
<li>Support for data from <ahref="https://whonet.org/">WHONET</a> and <ahref="https://ecdc.europa.eu/en/about-us/partnerships-and-networks/disease-and-laboratory-networks/ears-net">EARS-Net</a> (European Antimicrobial Resistance Surveillance Network):
<ul>
<ul>
<li>Exported files from WHONET can be read and used in this package. For functions like <code><ahref="../reference/first_isolate.html">first_isolate()</a></code> and <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code>, all parameters will be filled in automatically.</li>
<li>Exported files from WHONET can be read and used in this package. For functions like <code><ahref="../reference/first_isolate.html">first_isolate()</a></code> and <code><ahref="../reference/eucast_rules.html">eucast_rules()</a></code>, all parameters will be filled in automatically.</li>
@ -271,14 +271,33 @@ This data is updated annually - check the included version with the new function
</ul>
</ul>
</li>
</li>
<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>
<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>
<aclass="sourceLine"id="cb2-4"title="4"><spanclass="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>
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
These functions use <code><ahref="../reference/as.atc.html">as.atc()</a></code> internally. The old <code>atc_property</code> has been renamed <code><ahref="../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><ahref="../reference/as.mo.html">as.mo()</a></code> and e.g.<code>mo_genus</code>.</li>
These functions use <code><ahref="../reference/as.atc.html">as.atc()</a></code> internally. The old <code>atc_property</code> has been renamed <code><ahref="../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><ahref="../reference/as.mo.html">as.mo()</a></code> and e.g.<code>mo_genus</code>.</li>
<li>New functions <code><ahref="../reference/mo_source.html">set_mo_source()</a></code> and <code><ahref="../reference/mo_source.html">get_mo_source()</a></code> to use your own predefined MO codes as input for <code><ahref="../reference/as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions</li>
<li>New functions <code><ahref="../reference/mo_source.html">set_mo_source()</a></code> and <code><ahref="../reference/mo_source.html">get_mo_source()</a></code> to use your own predefined MO codes as input for <code><ahref="../reference/as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions</li>
<li>Support for the upcoming <ahref="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
<li>Support for the upcoming <ahref="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
@ -290,20 +309,20 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<li>New function <code><ahref="../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>New function <code><ahref="../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>
<li>
<p>New function <code><ahref="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><ahref="https://www.rdocumentation.org/packages/graphics/topics/plot">plot()</a></code> function can now be used for resistance prediction calculated with <code><ahref="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
<p>New function <code><ahref="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><ahref="https://www.rdocumentation.org/packages/graphics/topics/plot">plot()</a></code> function can now be used for resistance prediction calculated with <code><ahref="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
<p>Functions <code><ahref="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><ahref="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
<p>Functions <code><ahref="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><ahref="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
<li>New function <code><ahref="../reference/availability.html">availability()</a></code> to check the number of available (non-empty) results in a <code>data.frame</code>
<li>New function <code><ahref="../reference/availability.html">availability()</a></code> to check the number of available (non-empty) results in a <code>data.frame</code>
</li>
</li>
@ -332,10 +351,10 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<ul>
<ul>
<li>Incoercible results will now be considered ‘unknown’, MO code <code>UNKNOWN</code>. Properties of these will be translated on foreign systems in all language already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</li>
<li>Incoercible results will now be considered ‘unknown’, MO code <code>UNKNOWN</code>. Properties of these will be translated on foreign systems in all language already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</li>
<aclass="sourceLine"id="cb5-3"title="3"><spanclass="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<aclass="sourceLine"id="cb7-3"title="3"><spanclass="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<li>Fix for vector containing only empty values</li>
<li>Fix for vector containing only empty values</li>
<li>Finds better results when input is in other languages</li>
<li>Finds better results when input is in other languages</li>
@ -381,19 +400,19 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<ul>
<ul>
<li>
<li>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
<divclass="sourceCode"id="cb6"><preclass="sourceCode r"><codeclass="sourceCode r"><aclass="sourceLine"id="cb6-1"title="1"><spanclass="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<divclass="sourceCode"id="cb8"><preclass="sourceCode r"><codeclass="sourceCode r"><aclass="sourceLine"id="cb8-1"title="1"><spanclass="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<aclass="sourceLine"id="cb6-2"title="2"><spanclass="co"># OLD WAY</span></a>
<aclass="sourceLine"id="cb8-2"title="2"><spanclass="co"># OLD WAY</span></a>
<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>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>
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
@ -483,15 +502,15 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<aclass="sourceLine"id="cb9-3"title="3"><spanclass="st"></span><spanclass="kw">select</span>(<spanclass="op">-</span>count, <spanclass="op">-</span>cum_count) <spanclass="co"># only get item, percent, cum_percent</span></a></code></pre></div>
<aclass="sourceLine"id="cb11-3"title="3"><spanclass="st"></span><spanclass="kw">select</span>(<spanclass="op">-</span>count, <spanclass="op">-</span>cum_count) <spanclass="co"># only get item, percent, cum_percent</span></a></code></pre></div>
</li>
</li>
<li>Check for <code><ahref="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
<li>Check for <code><ahref="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
</li>
</li>
@ -571,18 +590,18 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
</li>
</li>
</ul>
</ul>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<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
<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>
<ul>
@ -593,18 +612,18 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
</li>
</li>
<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 Artificial Intelligence (AI):</p>
<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 Artificial Intelligence (AI):</p>
<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>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:
<li>Renamed all previous references to <code>bactid</code> to <code>mo</code>, like:
@ -632,12 +651,12 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
<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>
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
<li>For <code>first_isolate</code>, rows will be ignored when there’s no species available</li>
<li>For <code>first_isolate</code>, rows will be ignored when there’s 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>
<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>
@ -648,13 +667,13 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
</li>
</li>
<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>
<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>
<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>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>
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
@ -668,12 +687,12 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
</li>
</li>
<li>
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<p>The <code><code>antibiotics</code></code> data set will be searched for <code>ab_class</code> in the columns <code>atc_group1</code> and <code>atc_group2</code> (case-insensitive). Next, <code>tbl</code> will be checked for column names with a value in any abbreviations, codes or official names found in the <code>antibiotics</code> data set.</p>
<p>The <code><ahref='antibiotics.html'>antibiotics</a></code> data set will be searched for <code>ab_class</code> in the columns <code>atc_group1</code> and <code>atc_group2</code> (case-insensitive). Next, <code>tbl</code> will be checked for column names with a value in any abbreviations, codes or official names found in the <code>antibiotics</code> data set.</p>
Filter on specific antibiotic variables based on their class (ATC groups).
Filter on specific antibiotic variables based on their class (ATC groups).
}
}
\details{
\details{
The \code{\code{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
The \code{\link{antibiotics}} data set will be searched for \code{ab_class} in the columns \code{atc_group1} and \code{atc_group2} (case-insensitive). Next, \code{tbl} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
}
}
\examples{
\examples{
library(dplyr)
library(dplyr)
@ -80,3 +80,5 @@ septic_patients \%>\%
filter_aminoglycosides("R", "any") \%>\%
filter_aminoglycosides("R", "any") \%>\%
filter_fluoroquinolones("R", "any")
filter_fluoroquinolones("R", "any")
}
}
\keyword{fillter_class}
\keyword{filter}
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.