1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 00:02:38 +02:00

(v1.3.0.9001) website update

This commit is contained in:
2020-08-10 12:46:03 +02:00
parent 0d9602a6a9
commit 7d16bec21f
79 changed files with 2221 additions and 1974 deletions

View File

@ -81,7 +81,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">1.3.0.9000</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9001</span>
</span>
</div>
@ -229,9 +229,9 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div>
<div id="amr-1309000" class="section level1">
<h1 class="page-header" data-toc-text="1.3.0.9000">
<a href="#amr-1309000" class="anchor"></a>AMR 1.3.0.9000<small> Unreleased </small>
<div id="amr-1309001" class="section level1">
<h1 class="page-header" data-toc-text="1.3.0.9001">
<a href="#amr-1309001" class="anchor"></a>AMR 1.3.0.9001<small> Unreleased </small>
</h1>
<div id="last-updated-10-august-2020" class="section level2">
<h2 class="hasAnchor">
@ -243,13 +243,15 @@
<ul>
<li>
<p>Support for using <code>dplyr</code>s <code><a href="https://dplyr.tidyverse.org/reference/across.html">across()</a></code> in <code><a href="../reference/as.rsi.html">as.rsi()</a></code> to interpret MIC values or disk zone diameters, that now also automatically determines the column with microorganism names or codes.</p>
<div class="sourceCode" id="cb1"><pre class="r"><span class="co"># until dplyr 1.0.0</span>
<span class="no">your_data</span> <span class="kw">%&gt;%</span> <span class="fu">mutate_if</span>(<span class="no">is.mic</span>, <span class="no">as.rsi</span>)
<span class="no">your_data</span> <span class="kw">%&gt;%</span> <span class="fu">mutate_if</span>(<span class="no">is.disk</span>, <span class="no">as.rsi</span>)
<div class="sourceCode" id="cb1"><pre class="downlit">
<span class="co"># until dplyr 1.0.0</span>
<span class="kw">your_data</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_if</a></span>(<span class="kw">is.mic</span>, <span class="kw">as.rsi</span>)
<span class="kw">your_data</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_if</a></span>(<span class="kw">is.disk</span>, <span class="kw">as.rsi</span>)
<span class="co"># since dplyr 1.0.0</span>
<span class="no">your_data</span> <span class="kw">%&gt;%</span> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="fu">where</span>(<span class="no">is.mic</span>), <span class="no">as.rsi</span>))
<span class="no">your_data</span> <span class="kw">%&gt;%</span> <span class="fu">mutate</span>(<span class="fu">across</span>(<span class="fu">where</span>(<span class="no">is.disk</span>), <span class="no">as.rsi</span>))</pre></div>
<span class="kw">your_data</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html">across</a></span>(<span class="fu">where</span>(<span class="kw">is.mic</span>), <span class="kw">as.rsi</span>))
<span class="kw">your_data</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html">across</a></span>(<span class="fu">where</span>(<span class="kw">is.disk</span>), <span class="kw">as.rsi</span>))
</pre></div>
</li>
</ul>
</div>
@ -266,12 +268,14 @@
<li><p>Function <code><a href="../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><a href="../reference/as.ab.html">as.ab()</a></code> internally</p></li>
<li>
<p><a href="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><a href="https://dplyr.tidyverse.org/reference/select.html">dplyr::select()</a></code> and <code><a href="https://tidyr.tidyverse.org/reference/pivot_longer.html">tidyr::pivot_longer()</a></code>:</p>
<div class="sourceCode" id="cb2"><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>)
<div class="sourceCode" id="cb2"><pre class="downlit">
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>)
<span class="co"># Columns 'IPM' and 'MEM' are in the example_isolates data set</span>
<span class="no">example_isolates</span> <span class="kw">%&gt;%</span>
<span class="kw">example_isolates</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="fu"><a href="../reference/antibiotic_class_selectors.html">carbapenems</a></span>())
<span class="co">#&gt; Selecting carbapenems: `IPM` (imipenem), `MEM` (meropenem)</span></pre></div>
<span class="co">#&gt; Selecting carbapenems: `IPM` (imipenem), `MEM` (meropenem)</span>
</pre></div>
</li>
<li><p>Added <code><a href="../reference/mo_property.html">mo_domain()</a></code> as an alias to <code><a href="../reference/mo_property.html">mo_kingdom()</a></code></p></li>
<li><p>Added function <code><a href="../reference/filter_ab_class.html">filter_penicillins()</a></code> to filter isolates on a specific result in any column with a name in the antimicrobial penicillins class (more specific: ATC subgroup <em>Beta-lactam antibacterials, penicillins</em>)</p></li>
@ -294,7 +298,7 @@
<ul>
<li>95% speed improvement by using other base R functions for calculation</li>
<li>Using unexisting columns wil now return an error instead of dropping them silently</li>
<li>Using variables for column names (as well as selectors like <code><a href="https://dplyr.tidyverse.org/reference/reexports.html">dplyr::all_of()</a></code>) now works again</li>
<li>Using variables for column names (as well as selectors like <code><a href="https://tidyselect.r-lib.org/reference/all_of.html">dplyr::all_of()</a></code>) now works again</li>
</ul>
</li>
<li>
@ -349,7 +353,7 @@
<p>Making this package independent of especially the tidyverse (e.g. packages <code>dplyr</code> and <code>tidyr</code>) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.</p>
<p>Negative effects of this change are:</p>
<ul>
<li>Function <code>freq()</code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://rdrr.io/pkg/cleaner/man">library("cleaner")</a></code> before you use <code>freq()</code>.</li>
<li>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://github.com/msberends/cleaner">library("cleaner")</a></code> before you use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>.</li>
<li>Printing values of class <code>mo</code> or <code>rsi</code> in a tibble will no longer be in colour and printing <code>rsi</code> in a tibble will show the class <code>&lt;ord&gt;</code>, not <code>&lt;rsi&gt;</code> anymore. This is purely a visual effect.</li>
<li>All functions from the <code>mo_*</code> family (like <code><a href="../reference/mo_property.html">mo_name()</a></code> and <code><a href="../reference/mo_property.html">mo_gramstain()</a></code>) are noticeably slower when running on hundreds of thousands of rows.</li>
<li>For developers: classes <code>mo</code> and <code>ab</code> now both also inherit class <code>character</code>, to support any data transformation. This change invalidates code that checks for class length == 1.</li>
@ -453,11 +457,13 @@ 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><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb3"><pre class="r"><span class="no">yourdata</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="no">antibiotic1</span>:<span class="no">antibiotic25</span>), <span class="no">as.rsi</span>, <span class="kw">mo</span> <span class="kw">=</span> <span class="st">"E. coli"</span>)
<div class="sourceCode" id="cb3"><pre class="downlit">
<span class="kw">yourdata</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="kw">antibiotic1</span><span class="op">:</span><span class="kw">antibiotic25</span>), <span class="kw">as.rsi</span>, mo = <span class="st">"E. coli"</span>)
<span class="no">yourdata</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="no">antibiotic1</span>:<span class="no">antibiotic25</span>), <span class="no">as.rsi</span>, <span class="kw">mo</span> <span class="kw">=</span> <span class="no">.</span>$<span class="no">mybacteria</span>)</pre></div>
<span class="kw">yourdata</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="fu"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(<span class="kw">antibiotic1</span><span class="op">:</span><span class="kw">antibiotic25</span>), <span class="kw">as.rsi</span>, mo = <span class="kw">.</span><span class="op">$</span><span class="kw">mybacteria</span>)
</pre></div>
</li>
<li><p>Added antibiotic abbreviations for a laboratory manufacturer (GLIMS) for cefuroxime, cefotaxime, ceftazidime, cefepime, cefoxitin and trimethoprim/sulfamethoxazole</p></li>
<li><p>Added <code>uti</code> (as abbreviation of urinary tract infections) as parameter to <code><a href="../reference/as.rsi.html">as.rsi()</a></code>, so interpretation of MIC values and disk zones can be made dependent on isolates specifically from UTIs</p></li>
@ -480,21 +486,25 @@ 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><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="cb4"><pre class="r"><span class="fu"><a href="../reference/ab_property.html">ab_loinc</a></span>(<span class="st">"ampicillin"</span>)
<div class="sourceCode" id="cb4"><pre class="downlit">
<span class="fu"><a href="../reference/ab_property.html">ab_loinc</a></span>(<span class="st">"ampicillin"</span>)
<span class="co">#&gt; [1] "21066-6" "3355-5" "33562-0" "33919-2" "43883-8" "43884-6" "87604-5"</span>
<span class="fu"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="st">"21066-6"</span>)
<span class="co">#&gt; [1] "Ampicillin"</span>
<span class="fu"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="st">"21066-6"</span>)
<span class="co">#&gt; [1] "J01CA01"</span></pre></div>
<span class="co">#&gt; [1] "J01CA01"</span>
</pre></div>
</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="cb5"><pre class="r"><span class="fu"><a href="../reference/mo_property.html">mo_snomed</a></span>(<span class="st">"S. aureus"</span>)
<div class="sourceCode" id="cb5"><pre class="downlit">
<span class="fu"><a href="../reference/mo_property.html">mo_snomed</a></span>(<span class="st">"S. aureus"</span>)
<span class="co">#&gt; [1] 115329001 3092008 113961008</span>
<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="fl">115329001</span>)
<span class="co">#&gt; [1] "Staphylococcus aureus"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="fl">115329001</span>)
<span class="co">#&gt; [1] "Gram-positive"</span></pre></div>
<span class="co">#&gt; [1] "Gram-positive"</span>
</pre></div>
</li>
</ul>
</li>
@ -552,9 +562,13 @@ 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>
<div class="sourceCode" id="cb6"><pre class="r"><span class="kw">if</span> (<span class="fu"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="no">somebugs</span>) <span class="kw">==</span> <span class="st">"Enterobacteriaceae"</span>) <span class="no">...</span></pre></div>
<div class="sourceCode" id="cb6"><pre class="downlit">
<span class="co">if</span> (<span class="fu"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="kw">somebugs</span>) <span class="op">==</span> <span class="st">"Enterobacteriaceae"</span>) <span class="kw">...</span>
</pre></div>
<p>then please adjust this to:</p>
<div class="sourceCode" id="cb7"><pre class="r"><span class="kw">if</span> (<span class="fu"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="no">somebugs</span>) <span class="kw">==</span> <span class="st">"Enterobacterales"</span>) <span class="no">...</span></pre></div>
<div class="sourceCode" id="cb7"><pre class="downlit">
<span class="co">if</span> (<span class="fu"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="kw">somebugs</span>) <span class="op">==</span> <span class="st">"Enterobacterales"</span>) <span class="kw">...</span>
</pre></div>
</li>
</ul>
</li>
@ -566,12 +580,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<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="cb8"><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>)
<span class="no">example_isolates</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">bug</span> <span class="kw">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="no">mo</span>)) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(<span class="kw">amoxicillin</span> <span class="kw">=</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="no">AMX</span>),
<span class="kw">amox_clav</span> <span class="kw">=</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="no">AMC</span>)) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(!<span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(<span class="no">amoxicillin</span>) <span class="kw">|</span> !<span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(<span class="no">amox_clav</span>))</pre></div>
<div class="sourceCode" id="cb8"><pre class="downlit">
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>)
<span class="kw">example_isolates</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(bug = <span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="kw">mo</span>)) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise</a></span>(amoxicillin = <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="kw">AMX</span>),
amox_clav = <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="kw">AMC</span>)) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="op">!</span><span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(<span class="kw">amoxicillin</span>) <span class="op">|</span> <span class="op">!</span><span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span>(<span class="kw">amox_clav</span>))
</pre></div>
</li>
<li>
<p>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).</p>
@ -593,7 +609,8 @@ 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><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="cb9"><pre class="r"><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Stafylococcus aureus"</span>,
<div class="sourceCode" id="cb9"><pre class="downlit">
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"Stafylococcus aureus"</span>,
<span class="st">"staphylokok aureuz"</span>))
<span class="co">#&gt; Warning: </span>
<span class="co">#&gt; Results of two values were guessed with uncertainty. Use mo_uncertainties() to review them.</span>
@ -602,7 +619,8 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="fu"><a href="../reference/as.mo.html">mo_uncertainties</a></span>()
<span class="co">#&gt; "Stafylococcus aureus" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 95.2%)</span>
<span class="co">#&gt; "staphylokok aureuz" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 85.7%)</span></pre></div>
<span class="co">#&gt; "staphylokok aureuz" -&gt; Staphylococcus aureus (B_STPHY_AURS, score: 85.7%)</span>
</pre></div>
</li>
</ul>
</li>
@ -650,25 +668,29 @@ 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 parameter <code>include_unknown</code>:</p>
<div class="sourceCode" id="cb10"><pre class="r"><span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span>(<span class="no">...</span>, <span class="kw">include_unknown</span> <span class="kw">=</span> <span class="fl">TRUE</span>)</pre></div>
<div class="sourceCode" id="cb10"><pre class="downlit">
<span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span>(<span class="kw">...</span>, include_unknown = <span class="fl">TRUE</span>)
</pre></div>
<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>
<div class="sourceCode" id="cb11"><pre class="r"><span class="co"># how it works in base R:</span>
<span class="no">x</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span>(<span class="st">"A"</span>)
<span class="no">x</span>[<span class="fl">1</span>] <span class="kw">&lt;-</span> <span class="st">"B"</span>
<div class="sourceCode" id="cb11"><pre class="downlit">
<span class="co"># how it works in base R:</span>
<span class="kw">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/factor.html">factor</a></span>(<span class="st">"A"</span>)
<span class="kw">x</span>[<span class="fl">1</span>] <span class="op">&lt;-</span> <span class="st">"B"</span>
<span class="co">#&gt; Warning message:</span>
<span class="co">#&gt; invalid factor level, NA generated</span>
<span class="co"># how it now works similarly for classes 'mo' and 'ab':</span>
<span class="no">x</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)
<span class="no">x</span>[<span class="fl">1</span>] <span class="kw">&lt;-</span> <span class="st">"testvalue"</span>
<span class="kw">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)
<span class="kw">x</span>[<span class="fl">1</span>] <span class="op">&lt;-</span> <span class="st">"testvalue"</span>
<span class="co">#&gt; Warning message:</span>
<span class="co">#&gt; invalid microorganism code, NA generated</span></pre></div>
<span class="co">#&gt; invalid microorganism code, NA generated</span>
</pre></div>
<p>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.</p>
</li>
<li><p>Function <code>freq()</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>freq()</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).</p></li>
<li><p>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).</p></li>
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
</ul>
</div>
@ -678,9 +700,10 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<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="cb12"><pre class="r"><span class="no">x</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(<span class="no">example_isolates</span>)
<div class="sourceCode" id="cb12"><pre class="downlit">
<span class="kw">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(<span class="kw">example_isolates</span>)
<span class="co">#&gt; NOTE: Using column `mo` as input for `col_mo`.</span>
<span class="no">x</span>[<span class="fl">1</span>:<span class="fl">4</span>, ]
<span class="kw">x</span>[<span class="fl">1</span><span class="op">:</span><span class="fl">4</span>, ]
<span class="co">#&gt; mo ab S I R total</span>
<span class="co">#&gt; 1 A. baumannii AMC 0 0 3 3</span>
<span class="co">#&gt; 2 A. baumannii AMK 0 0 0 0</span>
@ -689,45 +712,52 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="co">#&gt; NOTE: Use 'format()' on this result to get a publicable/printable format.</span>
<span class="co"># change the transformation with the FUN argument to anything you like:</span>
<span class="no">x</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(<span class="no">example_isolates</span>, <span class="kw">FUN</span> <span class="kw">=</span> <span class="no">mo_gramstain</span>)
<span class="kw">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/bug_drug_combinations.html">bug_drug_combinations</a></span>(<span class="kw">example_isolates</span>, FUN = <span class="kw">mo_gramstain</span>)
<span class="co">#&gt; NOTE: Using column `mo` as input for `col_mo`.</span>
<span class="no">x</span>[<span class="fl">1</span>:<span class="fl">4</span>, ]
<span class="kw">x</span>[<span class="fl">1</span><span class="op">:</span><span class="fl">4</span>, ]
<span class="co">#&gt; mo ab S I R total</span>
<span class="co">#&gt; 1 Gram-negative AMC 469 89 174 732</span>
<span class="co">#&gt; 2 Gram-negative AMK 251 0 2 253</span>
<span class="co">#&gt; 3 Gram-negative AMP 227 0 405 632</span>
<span class="co">#&gt; 4 Gram-negative AMX 227 0 405 632</span>
<span class="co">#&gt; NOTE: Use 'format()' on this result to get a publicable/printable format.</span></pre></div>
<span class="co">#&gt; NOTE: Use 'format()' on this result to get a publicable/printable format.</span>
</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="cb13"><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/format.html">format</a></span>(<span class="no">x</span>, <span class="kw">combine_IR</span> <span class="kw">=</span> <span class="fl">FALSE</span>)</pre></div>
<div class="sourceCode" id="cb13"><pre class="downlit">
<span class="fu"><a href="https://rdrr.io/r/base/format.html">format</a></span>(<span class="kw">x</span>, combine_IR = <span class="fl">FALSE</span>)
</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="cb14"><pre class="r"># --------------------------------------------------------------------
# only_all_tested = FALSE only_all_tested = TRUE
# ----------------------- -----------------------
# Drug A Drug B include as include as include as include as
# numerator denominator numerator denominator
# -------- -------- ---------- ----------- ---------- -----------
# S or I S or I X X X X
# R S or I X X X X
# &lt;NA&gt; S or I X X - -
# S or I R X X X X
# R R - X - X
# &lt;NA&gt; R - - - -
# S or I &lt;NA&gt; X X - -
# R &lt;NA&gt; - - - -
# &lt;NA&gt; &lt;NA&gt; - - - -
# --------------------------------------------------------------------</pre></div>
<div class="sourceCode" id="cb14"><pre class="downlit">
<span class="co"># --------------------------------------------------------------------</span>
<span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span>
<span class="co"># ----------------------- -----------------------</span>
<span class="co"># Drug A Drug B include as include as include as include as</span>
<span class="co"># numerator denominator numerator denominator</span>
<span class="co"># -------- -------- ---------- ----------- ---------- -----------</span>
<span class="co"># S or I S or I X X X X</span>
<span class="co"># R S or I X X X X</span>
<span class="co"># &lt;NA&gt; S or I X X - -</span>
<span class="co"># S or I R X X X X</span>
<span class="co"># R R - X - X</span>
<span class="co"># &lt;NA&gt; R - - - -</span>
<span class="co"># S or I &lt;NA&gt; X X - -</span>
<span class="co"># R &lt;NA&gt; - - - -</span>
<span class="co"># &lt;NA&gt; &lt;NA&gt; - - - -</span>
<span class="co"># --------------------------------------------------------------------</span>
</pre></div>
<p>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>.</p>
</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="cb15"><pre class="r"><span class="co"># (run this on your own console, as this page does not support colour printing)</span>
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>)
<span class="no">example_isolates</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="no">mo</span>:<span class="no">AMC</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/reexports.html">as_tibble</a></span>()</pre></div>
<div class="sourceCode" id="cb15"><pre class="downlit">
<span class="co"># (run this on your own console, as this page does not support colour printing)</span>
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org">dplyr</a></span>)
<span class="kw">example_isolates</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">mo</span><span class="op">:</span><span class="kw">AMC</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://tibble.tidyverse.org/reference/as_tibble.html">as_tibble</a></span>()
</pre></div>
</li>
</ul>
</div>
@ -804,14 +834,16 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<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="cb16"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="no">AMX</span>, <span class="no">CIP</span>) <span class="kw">%&gt;%</span>
<div class="sourceCode" id="cb16"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">AMX</span>, <span class="kw">CIP</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/proportion.html">rsi_df</a></span>()
<span class="co"># antibiotic interpretation value isolates</span>
<span class="co"># 1 Amoxicillin SI 0.4442636 546</span>
<span class="co"># 2 Amoxicillin R 0.5557364 683</span>
<span class="co"># 3 Ciprofloxacin SI 0.8381831 1181</span>
<span class="co"># 4 Ciprofloxacin R 0.1618169 228</span></pre></div>
<span class="co"># 4 Ciprofloxacin R 0.1618169 228</span>
</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>
@ -829,12 +861,14 @@ 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>
<div class="sourceCode" id="cb17"><pre class="r"><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)
<div class="sourceCode" id="cb17"><pre class="downlit">
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)
<span class="co"># B_ESCHR_COL</span>
<span class="fu"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"UPEC"</span>)
<span class="co"># "Escherichia coli"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"EHEC"</span>)
<span class="co"># "Gram-negative"</span></pre></div>
<span class="co"># "Gram-negative"</span>
</pre></div>
</li>
<li><p>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</p></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>
@ -862,7 +896,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li>Fixed bug where not all old taxonomic names would be printed, when using a vector as input for <code><a href="../reference/as.mo.html">as.mo()</a></code>
</li>
<li>Manually added <em>Trichomonas vaginalis</em> from the kingdom of Protozoa, which is missing from the Catalogue of Life</li>
<li>Small improvements to <code><a href="https://rdrr.io/r/base/plot.html">plot()</a></code> and <code><a href="https://rdrr.io/r/graphics/barplot.html">barplot()</a></code> for MIC and RSI classes</li>
<li>Small improvements to <code><a href="https://rdrr.io/r/graphics/plot.default.html">plot()</a></code> and <code><a href="https://rdrr.io/r/graphics/barplot.html">barplot()</a></code> for MIC and RSI classes</li>
<li>Allow Catalogue of Life IDs to be coerced by <code><a href="../reference/as.mo.html">as.mo()</a></code>
</li>
</ul>
@ -925,21 +959,23 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new parameter <code>exact</code> to determine ages with decimals</li>
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
</li>
<li>Frequency tables (<code>freq()</code>):
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>):
<ul>
<li><p>speed improvement for microbial IDs</p></li>
<li><p>fixed factor level names for R Markdown</p></li>
<li><p>when all values are unique it now shows a message instead of a warning</p></li>
<li>
<p>support for boxplots:</p>
<div class="sourceCode" id="cb18"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<div class="sourceCode" id="cb18"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">age</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()
<span class="co"># grouped boxplots:</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">age</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()</pre></div>
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">hospital_id</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">age</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span>()
</pre></div>
</li>
</ul>
</li>
@ -948,7 +984,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
</li>
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
<li>Fix for <code>freq()</code> for when all values are <code>NA</code>
<li>Fix for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> for when all values are <code>NA</code>
</li>
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
@ -1025,7 +1061,8 @@ 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>
<div class="sourceCode" id="cb19"><pre class="r"><span class="fu"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()
<div class="sourceCode" id="cb19"><pre class="downlit">
<span class="fu"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_cephalosporins</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_1st_cephalosporins</a></span>()
@ -1035,23 +1072,28 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="fu"><a href="../reference/filter_ab_class.html">filter_fluoroquinolones</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span>()
<span class="fu"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()</pre></div>
<span class="fu"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()
</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="cb20"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="kw">result</span> <span class="kw">=</span> <span class="st">"R"</span>)
<div class="sourceCode" id="cb20"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(result = <span class="st">"R"</span>)
<span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="kw">result</span> <span class="kw">=</span> <span class="st">"R"</span>, <span class="kw">scope</span> <span class="kw">=</span> <span class="st">"all"</span>)
<span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span></pre></div>
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(result = <span class="st">"R"</span>, scope = <span class="st">"all"</span>)
<span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span>
</pre></div>
</li>
<li>
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
<div class="sourceCode" id="cb21"><pre class="r"><span class="no">ab_property</span> <span class="kw">-&gt;</span> <span class="fu">atc_property</span>()
<span class="no">ab_name</span> <span class="kw">-&gt;</span> <span class="fu">atc_name</span>()
<span class="no">ab_official</span> <span class="kw">-&gt;</span> <span class="fu">atc_official</span>()
<span class="no">ab_trivial_nl</span> <span class="kw">-&gt;</span> <span class="fu">atc_trivial_nl</span>()
<span class="no">ab_certe</span> <span class="kw">-&gt;</span> <span class="fu">atc_certe</span>()
<span class="no">ab_umcg</span> <span class="kw">-&gt;</span> <span class="fu">atc_umcg</span>()
<span class="no">ab_tradenames</span> <span class="kw">-&gt;</span> <span class="fu">atc_tradenames</span>()</pre></div>
<p>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>.</p>
<div class="sourceCode" id="cb21"><pre class="downlit">
<span class="kw">ab_property</span> <span class="op">-&gt;</span> <span class="fu">atc_property</span>()
<span class="kw">ab_name</span> <span class="op">-&gt;</span> <span class="fu">atc_name</span>()
<span class="kw">ab_official</span> <span class="op">-&gt;</span> <span class="fu">atc_official</span>()
<span class="kw">ab_trivial_nl</span> <span class="op">-&gt;</span> <span class="fu">atc_trivial_nl</span>()
<span class="kw">ab_certe</span> <span class="op">-&gt;</span> <span class="fu">atc_certe</span>()
<span class="kw">ab_umcg</span> <span class="op">-&gt;</span> <span class="fu">atc_umcg</span>()
<span class="kw">ab_tradenames</span> <span class="op">-&gt;</span> <span class="fu">atc_tradenames</span>()
</pre></div>
<p>These functions use <code>as.atc()</code> internally. The old <code>atc_property</code> has been renamed <code><a href="../reference/atc_online_property.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>.</p>
</li>
<li><p>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</p></li>
<li><p>Support for the upcoming <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</p></li>
@ -1062,21 +1104,27 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>New function <code><a href="../reference/age.html">age()</a></code> to calculate the (patients) age in years</p></li>
<li><p>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.</p></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/base/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="cb22"><pre class="r"><span class="no">x</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="no">septic_patients</span>, <span class="kw">col_ab</span> <span class="kw">=</span> <span class="st">"amox"</span>)
<span class="fu"><a href="https://rdrr.io/r/base/plot.html">plot</a></span>(<span class="no">x</span>)
<span class="fu"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(<span class="no">x</span>)</pre></div>
<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.default.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="cb22"><pre class="downlit">
<span class="kw">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="kw">septic_patients</span>, col_ab = <span class="st">"amox"</span>)
<span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html">plot</a></span>(<span class="kw">x</span>)
<span class="fu"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(<span class="kw">x</span>)
</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="cb23"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(<span class="no">...</span>)
<div class="sourceCode" id="cb23"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(<span class="kw">...</span>)
<span class="co"># or</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(<span class="no">septic_patients</span>, <span class="no">...</span>)</pre></div>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(<span class="kw">septic_patients</span>, <span class="kw">...</span>)
</pre></div>
<p>is equal to:</p>
<div class="sourceCode" id="cb24"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="kw">only_firsts</span> <span class="kw">=</span> <span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span>(<span class="no">septic_patients</span>, <span class="no">...</span>)) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="no">only_firsts</span> <span class="kw">==</span> <span class="fl">TRUE</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="no">only_firsts</span>)</pre></div>
<div class="sourceCode" id="cb24"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(only_firsts = <span class="fu"><a href="../reference/first_isolate.html">first_isolate</a></span>(<span class="kw">septic_patients</span>, <span class="kw">...</span>)) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw">only_firsts</span> <span class="op">==</span> <span class="fl">TRUE</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw">only_firsts</span>)
</pre></div>
</li>
<li><p>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></p></li>
<li><p>New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the <em>G</em>-test and more. These are also available (and even easier readable) on our website: <a href="https://msberends.gitlab.io/AMR" class="uri">https://msberends.gitlab.io/AMR</a>.</p></li>
@ -1097,40 +1145,46 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li>Removed data sets <code>microorganisms.oldDT</code>, <code>microorganisms.prevDT</code>, <code>microorganisms.unprevDT</code> and <code>microorganismsDT</code> since they were no longer needed and only contained info already available in the <code>microorganisms</code> data set</li>
<li>Added 65 antibiotics to the <code>antibiotics</code> data set, from the <a href="http://ec.europa.eu/health/documents/community-register/html/atc.htm">Pharmaceuticals Community Register</a> of the European Commission</li>
<li>Removed columns <code>atc_group1_nl</code> and <code>atc_group2_nl</code> from the <code>antibiotics</code> data set</li>
<li>Functions <code>atc_ddd()</code> and <code>atc_groups()</code> have been renamed <code><a href="../reference/atc_online.html">atc_online_ddd()</a></code> and <code><a href="../reference/atc_online.html">atc_online_groups()</a></code>. The old functions are deprecated and will be removed in a future version.</li>
<li>Functions <code>atc_ddd()</code> and <code>atc_groups()</code> have been renamed <code><a href="../reference/atc_online_property.html">atc_online_ddd()</a></code> and <code><a href="../reference/atc_online_property.html">atc_online_groups()</a></code>. The old functions are deprecated and will be removed in a future version.</li>
<li>Function <code>guess_mo()</code> is now deprecated in favour of <code><a href="../reference/as.mo.html">as.mo()</a></code> and will be removed in future versions</li>
<li>Function <code>guess_atc()</code> is now deprecated in favour of <code>as.atc()</code> and will be removed in future versions</li>
<li>Improvements for <code><a href="../reference/as.mo.html">as.mo()</a></code>:
<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="cb25"><pre class="r"><span class="co"># mo_fullname() uses as.mo() internally</span>
<div class="sourceCode" id="cb25"><pre class="downlit">
<span class="co"># mo_fullname() uses as.mo() internally</span>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Sthafilokockus aaureuz"</span>)
<span class="co">#&gt; [1] "Staphylococcus aureus"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. klossi"</span>)
<span class="co">#&gt; [1] "Staphylococcus kloosii"</span></pre></div>
<span class="co">#&gt; [1] "Staphylococcus kloosii"</span>
</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="cb26"><pre class="r"><span class="co"># equal:</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">...</span>, <span class="kw">allow_uncertain</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">...</span>, <span class="kw">allow_uncertain</span> <span class="kw">=</span> <span class="fl">2</span>)
<div class="sourceCode" id="cb26"><pre class="downlit">
<span class="co"># equal:</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">...</span>, allow_uncertain = <span class="fl">TRUE</span>)
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">...</span>, allow_uncertain = <span class="fl">2</span>)
<span class="co"># also equal:</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">...</span>, <span class="kw">allow_uncertain</span> <span class="kw">=</span> <span class="fl">FALSE</span>)
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">...</span>, <span class="kw">allow_uncertain</span> <span class="kw">=</span> <span class="fl">0</span>)</pre></div>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">...</span>, allow_uncertain = <span class="fl">FALSE</span>)
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">...</span>, allow_uncertain = <span class="fl">0</span>)
</pre></div>
<p>Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a></code> could lead to very unreliable results.</p>
</li>
<li><p>Implemented the latest publication of Becker <em>et al.</em> (2019), for categorising coagulase-negative <em>Staphylococci</em></p></li>
<li><p>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.</p></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="cb27"><pre class="r"><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="kw">language</span> <span class="kw">=</span> <span class="st">"es"</span>)
<div class="sourceCode" id="cb27"><pre class="downlit">
<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, language = <span class="st">"es"</span>)
<span class="co"># Warning: </span>
<span class="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span>
<span class="co">#&gt; [1] "(género desconocido)"</span></pre></div>
<span class="co">#&gt; [1] "(género desconocido)"</span>
</pre></div>
</li>
<li><p>Fix for vector containing only empty values</p></li>
<li><p>Finds better results when input is in other languages</p></li>
@ -1171,23 +1225,25 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
</ul>
</li>
<li>Frequency tables (<code>freq()</code> function):
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function):
<ul>
<li>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
<div class="sourceCode" id="cb28"><pre class="r"><span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span>
<div class="sourceCode" id="cb28"><pre class="downlit">
<span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span>
<span class="co"># OLD WAY</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="kw">genus</span> <span class="kw">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>)) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">genus</span>)
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(genus = <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="kw">mo</span>)) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">genus</span>)
<span class="co"># NEW WAY</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="kw">mo</span>))
<span class="co"># Even supports grouping variables:</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">gender</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="no">mo</span>))</pre></div>
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">gender</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="kw">mo</span>))
</pre></div>
</li>
<li><p>Header info is now available as a list, with the <code>header</code> function</p></li>
<li><p>The parameter <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</p></li>
@ -1257,10 +1313,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Fewer than 3 characters as input for <code>as.mo</code> will return NA</p></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="cb29"><pre class="r"><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span>
<div class="sourceCode" id="cb29"><pre class="downlit">
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></pre></div>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span>
</pre></div>
</li>
<li><p>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)</p></li>
<li><p>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</p></li>
@ -1268,19 +1326,23 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code></p></li>
<li><p>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</p></li>
<li>
<p>Frequency tables - <code>freq()</code>:</p>
<p>Frequency tables - <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>:</p>
<ul>
<li>
<p>Support for grouping variables, test with:</p>
<div class="sourceCode" id="cb30"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">gender</span>)</pre></div>
<div class="sourceCode" id="cb30"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="kw">hospital_id</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">gender</span>)
</pre></div>
</li>
<li>
<p>Support for (un)selecting columns:</p>
<div class="sourceCode" id="cb31"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span>
<span class="fu">freq</span>(<span class="no">hospital_id</span>) <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="no">count</span>, -<span class="no">cum_count</span>) <span class="co"># only get item, percent, cum_percent</span></pre></div>
<div class="sourceCode" id="cb31"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">hospital_id</span>) <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw">count</span>, <span class="op">-</span><span class="kw">cum_count</span>) <span class="co"># only get item, percent, cum_percent</span>
</pre></div>
</li>
<li><p>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code></p></li>
<li><p>Now prints in markdown at default in non-interactive sessions</p></li>
@ -1297,7 +1359,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</p></li>
<li><p>Fix for <code>mo_property</code> not working properly</p></li>
<li><p>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</p></li>
<li><p>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code></p></li>
<li><p>Support for named vectors of class <code>mo</code>, useful for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">top_freq()</a></code></p></li>
<li><p><code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> parameter</p></li>
<li>
<p>AI improvements for <code>as.mo</code>:</p>
@ -1356,18 +1418,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
</ul>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb32"><pre class="r"><span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)
<div class="sourceCode" id="cb32"><pre class="downlit">
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)
<span class="co"># [1] "Gram negative"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="kw">language</span> <span class="kw">=</span> <span class="st">"de"</span>) <span class="co"># German</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, language = <span class="st">"de"</span>) <span class="co"># German</span>
<span class="co"># [1] "Gramnegativ"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="kw">language</span> <span class="kw">=</span> <span class="st">"es"</span>) <span class="co"># Spanish</span>
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, language = <span class="st">"es"</span>) <span class="co"># Spanish</span>
<span class="co"># [1] "Gram negativo"</span>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="kw">language</span> <span class="kw">=</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span>
<span class="co"># [1] "Streptococcus grupo A"</span></pre></div>
<span class="fu"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, language = <span class="st">"pt"</span>) <span class="co"># Portuguese</span>
<span class="co"># [1] "Streptococcus grupo A"</span>
</pre></div>
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
<div class="sourceCode" id="cb33"><pre class="r"><span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)
<div class="sourceCode" id="cb33"><pre class="downlit">
<span class="fu"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)
<span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span>
<span class="co"># [1] "Gram negative"</span></pre></div>
<span class="co"># [1] "Gram negative"</span>
</pre></div>
</li>
<li>
<p>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</p>
@ -1378,18 +1444,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Function <code>is.rsi.eligible</code> to check for columns that have valid antimicrobial results, but do not have the <code>rsi</code> class yet. Transform the columns of your raw data with: <code>data %&gt;% mutate_if(is.rsi.eligible, as.rsi)</code></p></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="cb34"><pre class="r"><span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)
<div class="sourceCode" id="cb34"><pre class="downlit">
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)
<span class="co"># [1] B_ESCHR_COL</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)
<span class="co"># [1] B_STPHY_AUR</span>
<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)
<span class="co"># [1] B_STRPTC_GRA</span></pre></div>
<span class="co"># [1] B_STRPTC_GRA</span>
</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="cb35"><pre class="r"><span class="no">thousands_of_E_colis</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="st">"E. coli"</span>, <span class="fl">25000</span>)
<span class="kw pkg">microbenchmark</span><span class="kw ns">::</span><span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="no">thousands_of_E_colis</span>), <span class="kw">unit</span> <span class="kw">=</span> <span class="st">"s"</span>)
<div class="sourceCode" id="cb35"><pre class="downlit">
<span class="kw">thousands_of_E_colis</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="st">"E. coli"</span>, <span class="fl">25000</span>)
<span class="kw">microbenchmark</span>::<span class="fu"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="fu"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="kw">thousands_of_E_colis</span>), unit = <span class="st">"s"</span>)
<span class="co"># Unit: seconds</span>
<span class="co"># min median max neval</span>
<span class="co"># 0.01817717 0.01843957 0.03878077 100</span></pre></div>
<span class="co"># 0.01817717 0.01843957 0.03878077 100</span>
</pre></div>
</li>
<li><p>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</p></li>
<li>
@ -1417,12 +1487,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</p></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="cb36"><pre class="r"><span class="fu">ab_official</span>(<span class="st">"Bactroban"</span>)
<div class="sourceCode" id="cb36"><pre class="downlit">
<span class="fu">ab_official</span>(<span class="st">"Bactroban"</span>)
<span class="co"># [1] "Mupirocin"</span>
<span class="fu"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="fu"><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>))
<span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span>
<span class="fu"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="fu"><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>))
<span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></pre></div>
<span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span>
</pre></div>
</li>
<li><p>For <code>first_isolate</code>, rows will be ignored when theres no species available</p></li>
<li><p>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</p></li>
@ -1432,13 +1504,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Added parameters <code>minimum</code> and <code>as_percent</code> to <code>portion_df</code></p></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="cb37"><pre class="r"><span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="no">amox</span>, <span class="no">cipr</span>) <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span>()
<div class="sourceCode" id="cb37"><pre class="downlit">
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="kw">amox</span>, <span class="kw">cipr</span>) <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span>()
<span class="co"># which is the same as:</span>
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span>(<span class="no">amox</span>, <span class="no">cipr</span>)
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/count.html">count_IR</a></span>(<span class="kw">amox</span>, <span class="kw">cipr</span>)
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="no">amcl</span>)
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="no">amcl</span>, <span class="no">gent</span>)
<span class="no">septic_patients</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="no">amcl</span>, <span class="no">gent</span>, <span class="no">pita</span>)</pre></div>
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>)
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>, <span class="kw">gent</span>)
<span class="kw">septic_patients</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/AMR-deprecated.html">portion_S</a></span>(<span class="kw">amcl</span>, <span class="kw">gent</span>, <span class="kw">pita</span>)
</pre></div>
</li>
<li><p>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>.</p></li>
<li><p>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</p></li>
@ -1450,12 +1524,16 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<li><p>Added longest en shortest character length in the frequency table (<code>freq</code>) header of class <code>character</code></p></li>
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<div class="sourceCode" id="cb38"><pre class="r"><span class="no">my_matrix</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span>(<span class="no">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">age</span>, <span class="no">gender</span>), <span class="kw">ncol</span> <span class="kw">=</span> <span class="fl">2</span>))
<span class="fu">freq</span>(<span class="no">my_matrix</span>)</pre></div>
<div class="sourceCode" id="cb38"><pre class="downlit">
<span class="kw">my_matrix</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span>(<span class="kw">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="kw">age</span>, <span class="kw">gender</span>), ncol = <span class="fl">2</span>))
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">my_matrix</span>)
</pre></div>
<p>For lists, subsetting is possible:</p>
<div class="sourceCode" id="cb39"><pre class="r"><span class="no">my_list</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="kw">age</span> <span class="kw">=</span> <span class="no">septic_patients</span>$<span class="no">age</span>, <span class="kw">gender</span> <span class="kw">=</span> <span class="no">septic_patients</span>$<span class="no">gender</span>)
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu">freq</span>(<span class="no">age</span>)
<span class="no">my_list</span> <span class="kw">%&gt;%</span> <span class="fu">freq</span>(<span class="no">gender</span>)</pre></div>
<div class="sourceCode" id="cb39"><pre class="downlit">
<span class="kw">my_list</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(age = <span class="kw">septic_patients</span><span class="op">$</span><span class="kw">age</span>, gender = <span class="kw">septic_patients</span><span class="op">$</span><span class="kw">gender</span>)
<span class="kw">my_list</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">age</span>)
<span class="kw">my_list</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw">gender</span>)
</pre></div>
</li>
</ul>
</div>
@ -1529,13 +1607,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<ul>
<li>A vignette to explain its usage</li>
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
<li>Support for <code>table</code> to use as input: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(table(x, y))</a></code>
</li>
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://rdrr.io/r/graphics/hist.html">hist(freq(df$age))</a></code>
</li>
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
</li>
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
<li>Support for quasiquotation: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
</li>
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
@ -1700,7 +1778,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.9000.</p>
</div>
</footer>