* Updated `skimr::skim()` usage for MIC values to also include 25th and 75th percentiles
* Fix for plotting missing MIC/disk diffusion values
* Updated join functions to always use `dplyr` join functions if the `dplyr` package is installed - now also preserving grouped variables
* Fix for filtering on antibiotic classes (such as `filter_cephalosporins()`), which now also supports dplyr groups
* Updates for filtering on antibiotic classes (e.g., using `filter_carbapenems()`):
* Support for dplyr groups
* Support for base R row filtering:
```r
dim(example_isolates)
#> [1] 2000 49
example_isolates[filter_carbapenems(), ]
#> โน Applying `filter_carbapenems()`: values in any of columns 'IPM' (imipenem)
#> or 'MEM' (meropenem) are either "R", "S" or "I"
#> [1] 962 49
```
* Antibiotic class selectors (such as `cephalosporins()`) now maintain the column order from the original data
* Fix for selecting columns using `fluoroquinolones()`
### Other
* All unit tests are now processed by the `tinytest` package, instead of the `testthat` package. The `testthat` package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, defeating the purpose to test our package under less recent R versions. On the contrary, the `tinytest` package is very lightweight and dependency-free.
* All unit tests are now processed by the `tinytest` package, instead of the `testthat` package. The `testthat` package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, disallowing developers to test a package under any R 3.* version. On the contrary, the `tinytest` package is very lightweight and dependency-free.
#' To define antibiotics column names, leave as it is to determine it automatically with [guess_ab_col()] or input a text (case-insensitive), or use `NULL` to skip a column (e.g. `TIC = NULL` to skip ticarcillin). Manually defined but non-existing columns will be skipped with a warning.
#'
#' The following antibiotics are used for the functions [eucast_rules()] and [mdro()]. These are shown below in the format 'name (`antimicrobial ID`, [ATC code](https://www.whocc.no/atc/structure_and_principles/))', sorted alphabetically:
#' The following antibiotics are eligible for the functions [eucast_rules()] and [mdro()]. These are shown below in the format 'name (`antimicrobial ID`, [ATC code](https://www.whocc.no/atc/structure_and_principles/))', sorted alphabetically:
<spanclass="co">#> (kanamycin) and 'TOB' (tobramycin)</span>
<spanclass="co">#>โน Applying `carbapenems()`: selecting columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></code></pre></div>
<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-18-may-2021"class="anchor"></a><small>Last updated: 18 May 2021</small>
@ -307,15 +307,33 @@
@@ -307,15 +307,33 @@
<li>Updated <code><ahref="https://docs.ropensci.org/skimr/reference/skim.html">skimr::skim()</a></code> usage for MIC values to also include 25th and 75th percentiles</li>
<li>Fix for plotting missing MIC/disk diffusion values</li>
<li>Updated join functions to always use <code>dplyr</code> join functions if the <code>dplyr</code> package is installed - now also preserving grouped variables</li>
<li>Fix for filtering on antibiotic classes (such as <code><ahref="../reference/filter_ab_class.html">filter_cephalosporins()</a></code>), which now also supports dplyr groups</li>
<li>Updates for filtering on antibiotic classes (e.g., using <code><ahref="../reference/filter_ab_class.html">filter_carbapenems()</a></code>):
<li>Antibiotic class selectors (such as <code><ahref="../reference/antibiotic_class_selectors.html">cephalosporins()</a></code>) now maintain the column order from the original data</li>
<li>Fix for selecting columns using <code><ahref="../reference/antibiotic_class_selectors.html">fluoroquinolones()</a></code>
</li>
</ul>
</div>
<divid="other"class="section level3">
<h3class="hasAnchor">
<ahref="#other"class="anchor"></a>Other</h3>
<ul>
<li>All unit tests are now processed by the <code>tinytest</code> package, instead of the <code>testthat</code> package. The <code>testthat</code> package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, defeating the purpose to test our package under less recent R versions. On the contrary, the <code>tinytest</code> package is very lightweight and dependency-free.</li>
<li>All unit tests are now processed by the <code>tinytest</code> package, instead of the <code>testthat</code> package. The <code>testthat</code> package unfortunately requires tons of dependencies that are also heavy and only usable for recent R versions, disallowing developers to test a package under any R 3.* version. On the contrary, the <code>tinytest</code> package is very lightweight and dependency-free.</li>
</ul>
</div>
</div>
@ -348,7 +366,7 @@
@@ -348,7 +366,7 @@
</li>
<li>
<p>Functions <code><ahref="../reference/antibiotic_class_selectors.html">oxazolidinones()</a></code> (an antibiotic selector function) and <code><ahref="../reference/filter_ab_class.html">filter_oxazolidinones()</a></code> (an antibiotic filter function) to select/filter on e.g.ย linezolid and tedizolid</p>
<li><p><code>ggplot()</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>
<spanclass="va">example_isolates</span><spanclass="op">[</span><spanclass="fu"><ahref="https://rdrr.io/r/base/which.html">which</a></span><spanclass="op">(</span><spanclass="fu"><ahref="../reference/mo_property.html">mo_is_yeast</a></span><spanclass="op">(</span><spanclass="op">)</span><spanclass="op">)</span>, <spanclass="op">]</span><spanclass="co"># base R</span>
<li><p>Added Pretomanid (PMD, J04AK08) to the <code>antibiotics</code> data set</p></li>
<li>
<p>MIC values (see <code><ahref="../reference/as.mic.html">as.mic()</a></code>) can now be used in any mathematical processing, such as usage inside functions <code><ahref="https://rdrr.io/r/base/Extremes.html">min()</a></code>, <code><ahref="https://rdrr.io/r/base/Extremes.html">max()</a></code>, <code><ahref="https://rdrr.io/r/base/range.html">range()</a></code>, and with binary operators (<code><ahref="https://rdrr.io/r/base/Arithmetic.html">+</a></code>, <code><ahref="https://rdrr.io/r/base/Arithmetic.html">-</a></code>, etc.). This allows for easy distribution analysis and fast filtering on MIC values:</p>
<p>Functions <code><ahref="../reference/get_episode.html">get_episode()</a></code> and <code><ahref="../reference/get_episode.html">is_new_episode()</a></code> to determine (patient) episodes which are not necessarily based on microorganisms. The <code><ahref="../reference/get_episode.html">get_episode()</a></code> function returns the index number of the episode per group, while the <code><ahref="../reference/get_episode.html">is_new_episode()</a></code> function returns values <code>TRUE</code>/<code>FALSE</code> to indicate whether an item in a vector is the start of a new episode. They also support <code>dplyr</code>s grouping (i.e.ย using <code><ahref="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code>):</p>
<spanclass="co"># to select first isolates that are Gram-negative </span>
<spanclass="co"># and view results of cephalosporins and aminoglycosides:</span>
@ -532,7 +550,7 @@
@@ -532,7 +550,7 @@
</li>
<li>
<p>For antibiotic selection functions (such as <code><ahref="../reference/antibiotic_class_selectors.html">cephalosporins()</a></code>, <code><ahref="../reference/antibiotic_class_selectors.html">aminoglycosides()</a></code>) to select columns based on a certain antibiotic group, the dependency on the <code>tidyselect</code> package was removed, meaning that they can now also be used without the need to have this package installed and now also work in base R function calls (they rely on R 3.2 or later):</p>
<p>Data set <code>intrinsic_resistant</code>. This data set contains all bug-drug combinations where the โbugโ is intrinsic resistant to the โdrugโ according to the latest EUCAST insights. It contains just two columns: <code>microorganism</code> and <code>antibiotic</code>.</p>
<p>Curious about which enterococci are actually intrinsic resistant to vancomycin?</p>
<p>Support for using <code>dplyr</code>โs <code><ahref="https://dplyr.tidyverse.org/reference/across.html">across()</a></code> to interpret MIC values or disk zone diameters, which also automatically determines the column with microorganism names or codes.</p>
<p>Added intelligent data cleaning to <code><ahref="../reference/as.disk.html">as.disk()</a></code>, so numbers can also be extracted from text and decimal numbers will always be rounded up:</p>
<li><p>Function <code><ahref="../reference/ab_from_text.html">ab_from_text()</a></code> to retrieve antimicrobial drug names, doses and forms of administration from clinical texts in e.g.ย health care records, which also corrects for misspelling since it uses <code><ahref="../reference/as.ab.html">as.ab()</a></code> internally</p></li>
<li>
<p><ahref="https://tidyselect.r-lib.org/reference/language.html">Tidyverse selection helpers</a> for antibiotic classes, that help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. They can be used in any function that allows selection helpers, like <code><ahref="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code> and <code><ahref="https://tidyr.tidyverse.org/reference/pivot_longer.html">tidyr::pivot_longer()</a></code>:</p>
@ -869,7 +887,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -869,7 +887,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline</p></li>
<li>
<p>Interpretation from MIC values (and disk zones) to R/SI can now be used with <code><ahref="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the <code>dplyr</code> package:</p>
<spanclass="fu"><ahref="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span><spanclass="op">(</span><spanclass="fu"><ahref="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span><spanclass="op">(</span><spanclass="va">antibiotic1</span><spanclass="op">:</span><spanclass="va">antibiotic25</span><spanclass="op">)</span>, <spanclass="va">as.rsi</span>, mo <spanclass="op">=</span><spanclass="st">"E. coli"</span><spanclass="op">)</span>
@ -897,7 +915,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -897,7 +915,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>
<p>Support for LOINC codes in the <code>antibiotics</code> data set. Use <code><ahref="../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>
@ -908,7 +926,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -908,7 +926,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
<li>
<p>Support for SNOMED CT codes in the <code>microorganisms</code> data set. Use <code><ahref="../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>
@ -972,11 +990,11 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -972,11 +990,11 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>
<p>If you were dependent on the old Enterobacteriaceae family e.g.ย by using in your code:</p>
@ -990,7 +1008,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -990,7 +1008,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>
<p>Functions <code><ahref="../reference/proportion.html">susceptibility()</a></code> and <code><ahref="../reference/proportion.html">resistance()</a></code> as aliases of <code><ahref="../reference/proportion.html">proportion_SI()</a></code> and <code><ahref="../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>
@ -1019,7 +1037,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1019,7 +1037,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>More intelligent way of coping with some consonants like โlโ and โrโ</p></li>
<li>
<p>Added a score (a certainty percentage) to <code><ahref="../reference/as.mo.html">mo_uncertainties()</a></code>, that is calculated using the <ahref="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance</a>:</p>
@ -1077,14 +1095,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1077,14 +1095,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<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 argument <code>include_unknown</code>:</p>
<p>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.</p>
</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>
@ -1109,7 +1127,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1109,7 +1127,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>
<p>Function <code><ahref="../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><ahref="../reference/mo_property.html">mo_shortname()</a></code> at default:</p>
<spanclass="co">#> NOTE: Using column `mo` as input for `col_mo`.</span>
@ -1132,13 +1150,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1132,13 +1150,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<spanclass="co">#> NOTE: Use 'format()' on this result to get a publicable/printable format.</span></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><ahref="https://rdrr.io/r/base/format.html">format()</a></code> function:</p>
<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 argument <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>
@ -1160,7 +1178,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1160,7 +1178,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</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>
@ -1242,7 +1260,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1242,7 +1260,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>
<p>Function <code><ahref="../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><ahref="../reference/count.html">count_df()</a></code> and <code>portion_df()</code> to immediately show resistance percentages and number of available isolates:</p>
@ -1269,7 +1287,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1269,7 +1287,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li>UPEC (Uropathogenic <em>E. coli</em>)</li>
</ul>
<p>All these lead to the microbial ID of <em>E. coli</em>:</p>
@ -1373,7 +1391,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1373,7 +1391,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>when all values are unique it now shows a message instead of a warning</p></li>
@ -1466,7 +1484,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1466,7 +1484,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</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>
@ -1480,7 +1498,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1480,7 +1498,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<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>
<spanclass="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span>
@ -1489,7 +1507,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1489,7 +1507,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
<li>
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
@ -1510,7 +1528,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1510,7 +1528,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>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 AMR data analysis per age group.</p></li>
<li>
<p>New function <code><ahref="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><ahref="../reference/plot.html">plot()</a></code> function can now be used for resistance prediction calculated with <code><ahref="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
@ -1518,13 +1536,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
@@ -1518,13 +1536,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
<li>
<p>Functions <code><ahref="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><ahref="../reference/AMR-deprecated.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>