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

website update

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-12-30 10:27:28 +01:00
parent dc0c63132f
commit df6b334c6f
44 changed files with 275 additions and 269 deletions

View File

@ -163,7 +163,6 @@
<ul>
<li><a href="AMR.html">The AMR package - How to conduct AMR analysis</a></li>
<li><a href="freq.html">Creating Frequency Tables</a></li>
</ul>
</div>
</div>

View File

@ -1,3 +1,11 @@
/* class for footer */
.university {
background-image: url(logo_rug.png);
height: 40px;
background-size: 160px;
background-repeat: no-repeat;
}
/* Supports icons for brand using font-awesome */
.fab {
font-family: "Font Awesome 5 Brands" !important;

View File

@ -1,3 +1,11 @@
// Add updated Font Awesome 5.6.3 library
$('head').append('<!-- Updated Font Awesome library --><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">');
$('footer p').text($('footer p').text().replace('Developed by', 'Authors:'));
/* edit footer */
$( document ).ready(function() {
$('footer').html('<p>' +
$('footer .copyright p').html().replace("Developed by",
"<code>AMR</code> (for R). Developed at the University of Groningen.<br>Authors:") +
'</p>');
//$('footer').prepend("<div class='university'/>");
});

View File

@ -125,30 +125,26 @@
<p><code>AMR</code> is a free and open-source <a href="https://www.r-project.org">R package</a> to simplify the analysis and prediction of <strong>Antimicrobial Resistance (AMR)</strong> and to work with antibiotic properties by using evidence-based methods.</p>
<p>We created this package for academic research at the Faculty of Medical Sciences of the University of Groningen and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). We released this under the GNU General Public Licence v2.0 (GPL-2) which makes it free for everybody to use and distribute, for personal and commercial use, but it may <strong>not</strong> be used for patent purposes. Read further about our GPL-2 licence <a href="./LICENSE-text.html">here</a>.</p>
<p>This package is ready-to-use for a professional environment by specialists in the following fields:</p>
<ul>
<li>Medical Microbiology
<p>Medical Microbiology:</p>
<ul>
<li>Epidemiologists (both clinical microbiological and research)</li>
<li>Research Microbiologists</li>
<li>Biomedical Researchers</li>
<li>Research Pharmacologists</li>
</ul>
</li>
<li>Veterinary Microbiology
<p>Veterinary Microbiology:</p>
<ul>
<li>Research Veterinarians</li>
<li>Veterinary Epidemiologists</li>
<li>Biomedical Researchers</li>
</ul>
</li>
<li>Microbial Ecology
<p>Microbial Ecology:</p>
<ul>
<li>Soil Microbiologists</li>
<li>Extremophile Researchers</li>
<li>Astrobiologists</li>
</ul>
</li>
<li>Other specialists in any of the above fields:
<p>Other specialists in any of the above fields:</p>
<ul>
<li>Data Scientists/Data Analysts</li>
<li>Biotechnologists</li>
@ -156,15 +152,12 @@
<li>Geneticists</li>
<li>Molecular Biologists/Microbiologists</li>
</ul>
</li>
<li>Developers
<p>Developers:</p>
<ul>
<li>Package developers for R</li>
<li>Software developers</li>
<li>Web application developers</li>
</ul>
</li>
</ul>
<div id="get-this-package" class="section level3">
<h3 class="hasAnchor">
<a href="#get-this-package" class="anchor"></a>Get this package</h3>

View File

@ -180,13 +180,13 @@
<li>Function <code>age</code> to calculate the (patients) age in years</li>
<li>Function <code>age_groups</code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</li>
<li>
<p>Functions <code>filter_first_isolate</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="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>()</a>
<p>Functions <code>filter_first_isolate</code> and <code>filter_first_weighted_isolate()</code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">filter_first_isolate</span>()</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="co"># or</span></a>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients)</a></code></pre></div>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw">filter_first_isolate</span>(septic_patients)</a></code></pre></div>
<p>is equal to:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw">first_isolate</span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/filter">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
</li>
@ -242,6 +242,7 @@
<li>Automatic parameter filling for <code>mdro</code>, <code>key_antibiotics</code> and <code>eucast_rules</code>
</li>
<li>Updated examples for resistance prediction (<code>resistance_predict</code> function)</li>
<li>Fix for <code>as.mic</code> to support more values ending in (several) zeroes</li>
</ul>
</div>
<div id="other" class="section level4">
@ -296,30 +297,30 @@
<li>Fewer than 3 characters as input for <code>as.mo</code> will return NA</li>
<li>
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw">as.mo</span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="kw">mo_fullname</span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="kw">as.mo</span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="kw">mo_fullname</span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
</li>
<li>Added parameter <code>combine_IR</code> (TRUE/FALSE) to functions <code>portion_df</code> and <code>count_df</code>, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</li>
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
<li>Added parameter <code>also_single_tested</code> for <code>portion_*</code> and <code>count_*</code> functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see <code><a href="../reference/portion.html">?portion</a></code>
<li>Added parameter <code>also_single_tested</code> for <code>portion_*</code> and <code>count_*</code> functions to also include cases where not all antibiotics were tested but at least one of the tested antibiotics includes the target antimicribial interpretation, see <code>?portion</code>
</li>
<li>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code>
</li>
<li>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</li>
<li>Frequency tables - <code><a href="../reference/freq.html">freq()</a></code>:
<li>Frequency tables - <code>freq()</code>:
<ul>
<li>
<p>Support for grouping variables, test with:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
</li>
<li>
<p>Support for (un)selecting columns:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="st"> </span><span class="kw">freq</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
</li>
<li>Check for <code><a href="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
@ -340,7 +341,7 @@
<li>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</li>
<li>Fix for <code>mo_property</code> not working properly</li>
<li>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</li>
<li>Support for named vectors of class <code>mo</code>, useful for <code><a href="../reference/freq.html">top_freq()</a></code>
<li>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code>
</li>
<li>
<code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> parameter</li>
@ -400,16 +401,16 @@
</li>
</ul>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw">mo_gramstain</span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="kw">mo_fullname</span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw">mo_gramstain</span>(<span class="st">"Esc blattae"</span>)</a>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
</li>
@ -422,15 +423,15 @@
</li>
<li>
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using Artificial Intelligence (AI):</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw">as.mo</span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="kw">as.mo</span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="kw">as.mo</span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb8-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">thousands_of_E_colis &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
<a class="sourceLine" id="cb9-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb9-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw">microbenchmark</span>(<span class="kw">as.mo</span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="co"># min median max neval</span></a>
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
@ -461,11 +462,11 @@
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
<li>
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw"><a href="../reference/ab_property.html">ab_official</a></span>(<span class="st">"Bactroban"</span>)</a>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="kw">ab_name</span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="kw">ab_atc</span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb10-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
</li>
<li>For <code>first_isolate</code>, rows will be ignored when theres no species available</li>
@ -477,13 +478,13 @@
</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="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">count_IR</span>()</a>
<a class="sourceLine" id="cb11-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
<a class="sourceLine" id="cb11-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
<a class="sourceLine" id="cb11-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">count_IR</span>(amox, cipr)</a>
<a class="sourceLine" id="cb11-4" data-line-number="4"></a>
<a class="sourceLine" id="cb11-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl)</a>
<a class="sourceLine" id="cb11-6" data-line-number="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent)</a>
<a class="sourceLine" id="cb11-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
<a class="sourceLine" id="cb11-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl)</a>
<a class="sourceLine" id="cb11-6" data-line-number="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl, gent)</a>
<a class="sourceLine" id="cb11-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">portion_S</span>(amcl, gent, pita)</a></code></pre></div>
</li>
<li>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</li>
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
@ -498,11 +499,11 @@
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(septic_patients, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw"><a href="../reference/freq.html">freq</a></span>(my_matrix)</a></code></pre></div>
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw">freq</span>(my_matrix)</a></code></pre></div>
<p>For lists, subsetting is possible:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
<a class="sourceLine" id="cb13-2" data-line-number="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(age)</a>
<a class="sourceLine" id="cb13-3" data-line-number="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
<a class="sourceLine" id="cb13-2" data-line-number="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">freq</span>(age)</a>
<a class="sourceLine" id="cb13-3" data-line-number="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
</li>
</ul>
</div>
@ -544,7 +545,7 @@
<ul>
<li>
<code>septic_patients %&gt;% select(tobr, gent) %&gt;% ggplot_rsi</code> will show portions of S, I and R immediately in a pretty plot</li>
<li>Support for grouped variables, see <code><a href="../reference/ggplot_rsi.html">?ggplot_rsi</a></code>
<li>Support for grouped variables, see <code>?ggplot_rsi</code>
</li>
</ul>
</li>
@ -565,7 +566,7 @@
<li>
<del>Function <code>ratio</code> to transform a vector of values to a preset ratio</del>
<ul>
<li><del>For example: <code><a href="../reference/AMR-deprecated.html">ratio(c(10, 500, 10), ratio = "1:2:1")</a></code> would return <code>130, 260, 130</code></del></li>
<li><del>For example: <code>ratio(c(10, 500, 10), ratio = "1:2:1")</code> would return <code>130, 260, 130</code></del></li>
</ul>
</li>
<li>Support for Addins menu in RStudio to quickly insert <code>%in%</code> or <code>%like%</code> (and give them keyboard shortcuts), or to view the datasets that come with this package</li>
@ -576,13 +577,13 @@
<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><a href="../reference/freq.html">freq(table(x, y))</a></code>
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</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://www.rdocumentation.org/packages/graphics/topics/hist">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><a href="../reference/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</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>
@ -614,16 +615,16 @@
<li>Combined MIC/RSI values will now be coerced by the <code>rsi</code> and <code>mic</code> functions:
<ul>
<li>
<code><a href="../reference/as.rsi.html">as.rsi("&lt;=0.002; S")</a></code> will return <code>S</code>
<code>as.rsi("&lt;=0.002; S")</code> will return <code>S</code>
</li>
<li>
<code><a href="../reference/as.mic.html">as.mic("&lt;=0.002; S")</a></code> will return <code>&lt;=0.002</code>
<code>as.mic("&lt;=0.002; S")</code> will return <code>&lt;=0.002</code>
</li>
</ul>
</li>
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code><a href="../reference/as.mic.html">as.mic("&lt;= 0.002")</a></code> now works</li>
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code>as.mic("&lt;= 0.002")</code> now works</li>
<li>Classes <code>rsi</code> and <code>mic</code> do not add the attribute <code>package.version</code> anymore</li>
<li>Added <code>"groups"</code> option for <code><a href="../reference/atc_property.html">atc_property(..., property)</a></code>. It will return a vector of the ATC hierarchy as defined by the <a href="https://www.whocc.no/atc/structure_and_principles/">WHO</a>. The new function <code>atc_groups</code> is a convenient wrapper around this.</li>
<li>Added <code>"groups"</code> option for <code>atc_property(..., property)</code>. It will return a vector of the ATC hierarchy as defined by the <a href="https://www.whocc.no/atc/structure_and_principles/">WHO</a>. The new function <code>atc_groups</code> is a convenient wrapper around this.</li>
<li>Build-in host check for <code>atc_property</code> as it requires the host set by <code>url</code> to be responsive</li>
<li>Improved <code>first_isolate</code> algorithm to exclude isolates where bacteria ID or genus is unavailable</li>
<li>Fix for warning <em>hybrid evaluation forced for row_number</em> (<a href="https://github.com/tidyverse/dplyr/commit/924b62"><code>924b62</code></a>) from the <code>dplyr</code> package v0.7.5 and above</li>
@ -661,7 +662,7 @@
<ul>
<li>Full support for Windows, Linux and macOS</li>
<li>Full support for old R versions, only R-3.0.0 (April 2013) or later is needed (needed packages may have other dependencies)</li>
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="http://dplyr.tidyverse.org/reference/summarise.html">dplyr::summarise</a></code>, see ?rsi</li>
<li>Function <code>n_rsi</code> to count cases where antibiotic test results were available, to be used in conjunction with <code><a href="https://www.rdocumentation.org/packages/dplyr/topics/summarise">dplyr::summarise</a></code>, see ?rsi</li>
<li>Function <code>guess_bactid</code> to <strong>determine the ID</strong> of a microorganism based on genus/species or known abbreviations like MRSA</li>
<li>Function <code>guess_atc</code> to <strong>determine the ATC</strong> of an antibiotic based on name, trade name, or known abbreviations</li>
<li>Function <code>freq</code> to create <strong>frequency tables</strong>, with additional info in a header</li>
@ -674,7 +675,7 @@
<li>Functions <code>BRMO</code> and <code>MRGN</code> are wrappers for Dutch and German guidelines, respectively</li>
</ul>
</li>
<li>New algorithm to determine weighted isolates, can now be <code>"points"</code> or <code>"keyantibiotics"</code>, see <code><a href="../reference/first_isolate.html">?first_isolate</a></code>
<li>New algorithm to determine weighted isolates, can now be <code>"points"</code> or <code>"keyantibiotics"</code>, see <code>?first_isolate</code>
</li>
<li>New print format for <code>tibble</code>s and <code>data.table</code>s</li>
</ul>

View File

@ -1,9 +1,7 @@
pandoc: 2.3.1
pkgdown: 1.3.0
pkgdown_sha: ~
articles:
AMR: AMR.html
freq: freq.html
articles: []
urls:
reference: https://msberends.gitlab.io/reference
article: https://msberends.gitlab.io/articles

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Use these functions to return a specific property of an antibiotic from the <code><a href='antibiotics.html'>antibiotics</a></code> data set, based on their ATC code. Get such a code with <code><a href='as.atc.html'>as.atc</a></code>.</p>
<p>Use these functions to return a specific property of an antibiotic from the <code>antibiotics</code> data set, based on their ATC code. Get such a code with <code>as.atc</code>.</p>
</div>
@ -188,11 +188,11 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>x</th>
<td><p>a (vector of a) valid <code><a href='as.atc.html'>atc</a></code> code or any text that can be coerced to a valid atc with <code><a href='as.atc.html'>as.atc</a></code></p></td>
<td><p>a (vector of a) valid <code>atc</code> code or any text that can be coerced to a valid atc with <code>as.atc</code></p></td>
</tr>
<tr>
<th>property</th>
<td><p>one of the column names of one of the <code><a href='antibiotics.html'>antibiotics</a></code> data set, like <code>"atc"</code> and <code>"official"</code></p></td>
<td><p>one of the column names of one of the <code>antibiotics</code> data set, like <code>"atc"</code> and <code>"official"</code></p></td>
</tr>
<tr>
<th>language</th>
@ -206,7 +206,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='antibiotics.html'>antibiotics</a></code></p></div>
<div class='dont-index'><p><code>antibiotics</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Convert antibiotic codes to a (trivial) antibiotic name or ATC code, or vice versa. This uses the data from <code><a href='antibiotics.html'>antibiotics</a></code>.</p>
<p>Convert antibiotic codes to a (trivial) antibiotic name or ATC code, or vice versa. This uses the data from <code>antibiotics</code>.</p>
</div>
@ -179,7 +179,7 @@
</tr>
<tr>
<th>from, to</th>
<td><p>type to transform from and to. See <code><a href='antibiotics.html'>antibiotics</a></code> for its column names. WIth <code>from = "guess"</code> the from will be guessed from <code>"atc"</code>, <code>"certe"</code> and <code>"umcg"</code>. When using <code>to = "atc"</code>, the ATC code will be searched using <code><a href='as.atc.html'>as.atc</a></code>.</p></td>
<td><p>type to transform from and to. See <code>antibiotics</code> for its column names. WIth <code>from = "guess"</code> the from will be guessed from <code>"atc"</code>, <code>"certe"</code> and <code>"umcg"</code>. When using <code>to = "atc"</code>, the ATC code will be searched using <code>as.atc</code>.</p></td>
</tr>
<tr>
<th>textbetween</th>
@ -193,11 +193,11 @@
<h2 class="hasAnchor" id="source"><a class="anchor" href="#source"></a>Source</h2>
<p><code><a href='antibiotics.html'>antibiotics</a></code></p>
<p><code>antibiotics</code></p>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p><strong>The <code><a href='ab_property.html'>ab_property</a></code> functions are faster and more concise</strong>, but do not support concatenated strings, like <code>abname("AMCL+GENT"</code>.</p>
<p><strong>The <code>ab_property</code> functions are faster and more concise</strong>, but do not support concatenated strings, like <code>abname("AMCL+GENT"</code>.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>

View File

@ -188,7 +188,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='age_groups.html'>age_groups</a></code> to splits age into groups</p></div>
<div class='dont-index'><p><code>age_groups</code> to splits age into groups</p></div>
</div>

View File

@ -174,7 +174,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>x</th>
<td><p>age, e.g. calculated with <code><a href='age.html'>age</a></code></p></td>
<td><p>age, e.g. calculated with <code>age</code></p></td>
</tr>
<tr>
<th>split_at</th>
@ -201,7 +201,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='age.html'>age</a></code> to determine ages based on one or more reference dates</p></div>
<div class='dont-index'><p><code>age</code> to determine ages based on one or more reference dates</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -230,13 +230,13 @@
<span class='co'># resistance of ciprofloxacine per age group</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
<span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='ggplot_rsi.html'>ggplot_rsi</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -175,11 +175,11 @@
<dt><code>atc</code></dt><dd><p>ATC code, like <code>J01CR02</code></p></dd>
<dt><code>certe</code></dt><dd><p>Certe code, like <code>amcl</code></p></dd>
<dt><code>umcg</code></dt><dd><p>UMCG code, like <code>AMCL</code></p></dd>
<dt><code>abbr</code></dt><dd><p>Abbreviation as used by many countries, used internally by <code><a href='as.atc.html'>as.atc</a></code></p></dd>
<dt><code>abbr</code></dt><dd><p>Abbreviation as used by many countries, used internally by <code>as.atc</code></p></dd>
<dt><code>official</code></dt><dd><p>Official name by the WHO, like <code>"Amoxicillin and beta-lactamase inhibitor"</code></p></dd>
<dt><code>official_nl</code></dt><dd><p>Official name in the Netherlands, like <code>"Amoxicilline met enzymremmer"</code></p></dd>
<dt><code>trivial_nl</code></dt><dd><p>Trivial name in Dutch, like <code>"Amoxicilline/clavulaanzuur"</code></p></dd>
<dt><code>trade_name</code></dt><dd><p>Trade name as used by many countries (a total of 294), used internally by <code><a href='as.atc.html'>as.atc</a></code></p></dd>
<dt><code>trade_name</code></dt><dd><p>Trade name as used by many countries (a total of 294), used internally by <code>as.atc</code></p></dd>
<dt><code>oral_ddd</code></dt><dd><p>Defined Daily Dose (DDD), oral treatment</p></dd>
<dt><code>oral_units</code></dt><dd><p>Units of <code>ddd_units</code></p></dd>
<dt><code>iv_ddd</code></dt><dd><p>Defined Daily Dose (DDD), parenteral treatment</p></dd>
@ -198,7 +198,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code></p></div>
<div class='dont-index'><p><code>microorganisms</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Use this function to determine the ATC code of one or more antibiotics. The data set <code><a href='antibiotics.html'>antibiotics</a></code> will be searched for abbreviations, official names and trade names.</p>
<p>Use this function to determine the ATC code of one or more antibiotics. The data set <code>antibiotics</code> will be searched for abbreviations, official names and trade names.</p>
</div>
@ -188,13 +188,13 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>Use the <code><a href='ab_property.html'>ab_property</a></code> functions to get properties based on the returned ATC code, see Examples.</p>
<p>Use the <code>ab_property</code> functions to get properties based on the returned ATC code, see Examples.</p>
<p>In the ATC classification system, the active substances are classified in a hierarchy with five different levels. The system has fourteen main anatomical/pharmacological groups or 1st levels. Each ATC main group is divided into 2nd levels which could be either pharmacological or therapeutic groups. The 3rd and 4th levels are chemical, pharmacological or therapeutic subgroups and the 5th level is the chemical substance. The 2nd, 3rd and 4th levels are often used to identify pharmacological subgroups when that is considered more appropriate than therapeutic or chemical subgroups.
Source: <a href='https://www.whocc.no/atc/structure_and_principles/'>https://www.whocc.no/atc/structure_and_principles/</a></p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='antibiotics.html'>antibiotics</a></code> for the dataframe that is being used to determine ATCs.</p></div>
<div class='dont-index'><p><code>antibiotics</code> for the dataframe that is being used to determine ATCs.</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -212,8 +212,8 @@
<span class='co'># Use ab_* functions to get a specific property based on an ATC code</span>
<span class='no'>Cipro</span> <span class='kw'>&lt;-</span> <span class='fu'>as.atc</span>(<span class='st'>"cipro"</span>) <span class='co'># returns `J01MA02`</span>
<span class='fu'><a href='ab_property.html'>ab_official</a></span>(<span class='no'>Cipro</span>) <span class='co'># returns "Ciprofloxacin"</span>
<span class='fu'><a href='ab_property.html'>ab_umcg</a></span>(<span class='no'>Cipro</span>) <span class='co'># returns "CIPR", the code used in the UMCG</span>
<span class='fu'>ab_official</span>(<span class='no'>Cipro</span>) <span class='co'># returns "Ciprofloxacin"</span>
<span class='fu'>ab_umcg</span>(<span class='no'>Cipro</span>) <span class='co'># returns "CIPR", the code used in the UMCG</span>
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -190,7 +190,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.rsi.html'>as.rsi</a></code></p></div>
<div class='dont-index'><p><code>as.rsi</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -203,7 +203,7 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>mic_data</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>mic_data</span>)
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>mic_data</span>)
<span class='fu'>freq</span>(<span class='no'>mic_data</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -198,7 +198,7 @@
</tr>
<tr>
<th>reference_df</th>
<td><p>a <code>data.frame</code> to use for extra reference when translating <code>x</code> to a valid <code>mo</code>. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid <code>mo</code> as found in the <code><a href='microorganisms.html'>microorganisms</a></code> data set.</p></td>
<td><p>a <code>data.frame</code> to use for extra reference when translating <code>x</code> to a valid <code>mo</code>. The first column can be any microbial name, code or ID (used in your analysis or organisation), the second column must be a valid <code>mo</code> as found in the <code>microorganisms</code> data set.</p></td>
</tr>
</table>
@ -221,7 +221,7 @@
| ----&gt; genus, a 5-7 letter acronym, mostly without vowels
----&gt; taxonomic kingdom, either B (Bacteria), F (Fungi) or P (Protozoa)
</pre>
<p>Use the <code><a href='mo_property.html'>mo_property</a></code> functions to get properties based on the returned code, see Examples.</p>
<p>Use the <code>mo_property</code> functions to get properties based on the returned code, see Examples.</p>
<p>This function uses Artificial Intelligence (AI) to help getting fast and logical results. It tries to find matches in this order:</p><ul>
<li><p>Taxonomic kingdom: it first searches in bacteria, then fungi, then protozoa</p></li>
<li><p>Human pathogenic prevalence: it first searches in more prevalent microorganisms, then less prevalent ones</p></li>
@ -258,8 +258,8 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code> for the <code>data.frame</code> with ITIS content that is being used to determine ID's. <br />
The <code><a href='mo_property.html'>mo_property</a></code> functions (like <code><a href='mo_property.html'>mo_genus</a></code>, <code><a href='mo_property.html'>mo_gramstain</a></code>) to get properties based on the returned code.</p></div>
<div class='dont-index'><p><code>microorganisms</code> for the <code>data.frame</code> with ITIS content that is being used to determine ID's. <br />
The <code>mo_property</code> functions (like <code>mo_genus</code>, <code>mo_gramstain</code>) to get properties based on the returned code.</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -291,10 +291,10 @@ The <code><a href='mo_property.html'>mo_property</a></code> functions (like <cod
<span class='co'># Use mo_* functions to get a specific property based on `mo`</span>
<span class='no'>Ecoli</span> <span class='kw'>&lt;-</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>) <span class='co'># returns `B_ESCHR_COL`</span>
<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Escherichia"</span>
<span class='fu'><a href='mo_property.html'>mo_gramstain</a></span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Gram negative"</span>
<span class='fu'>mo_genus</span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Escherichia"</span>
<span class='fu'>mo_gramstain</span>(<span class='no'>Ecoli</span>) <span class='co'># returns "Gram negative"</span>
<span class='co'># but it uses as.mo internally too, so you could also just use:</span>
<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Escherichia"</span>
<span class='fu'>mo_genus</span>(<span class='st'>"E. coli"</span>) <span class='co'># returns "Escherichia"</span>
<span class='co'># }</span><span class='co'># NOT RUN {</span>
@ -303,16 +303,16 @@ The <code><a href='mo_property.html'>mo_property</a></code> functions (like <cod
<span class='co'># the select function of tidyverse is also supported:</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'>&lt;-</span> <span class='no'>df</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>microorganism_name</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>as.mo</span>()
<span class='co'># and can even contain 2 columns, which is convenient for genus/species combinations:</span>
<span class='no'>df</span>$<span class='no'>mo</span> <span class='kw'>&lt;-</span> <span class='no'>df</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>as.mo</span>()
<span class='co'># although this works easier and does the same:</span>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>df</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)))
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -192,7 +192,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mic.html'>as.mic</a></code></p></div>
<div class='dont-index'><p><code>as.mic</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -206,16 +206,16 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for percentages</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for frequencies</span>
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
<span class='fu'>freq</span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
<span class='co'># using dplyr's mutate</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_at</a></span>(<span class='fu'><a href='http://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_at</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/vars'>vars</a></span>(<span class='no'>peni</span>:<span class='no'>rifa</span>), <span class='no'>as.rsi</span>)
<span class='co'># fastest way to transform all columns with already valid AB results to class `rsi`:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise_all.html'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise_all'>mutate_if</a></span>(<span class='no'>is.rsi.eligible</span>,
<span class='no'>as.rsi</span>)
<span class='co'># }</span></pre>
</div>

View File

@ -232,7 +232,7 @@
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># NOT RUN {</span>
<span class='co'># What's the ATC of amoxicillin?</span>
<span class='fu'><a href='as.atc.html'>guess_atc</a></span>(<span class='st'>"Amoxicillin"</span>)
<span class='fu'>guess_atc</span>(<span class='st'>"Amoxicillin"</span>)
<span class='co'># [1] "J01CA04"</span>
<span class='co'># oral DDD (Defined Daily Dose) of amoxicillin</span>

View File

@ -191,7 +191,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>...</th>
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed.</p></td>
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code>as.rsi</code> if needed.</p></td>
</tr>
<tr>
<th>also_single_tested</th>
@ -199,11 +199,11 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
</tr>
<tr>
<th>data</th>
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code>as.rsi</code>)</p></td>
</tr>
<tr>
<th>translate_ab</th>
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations to, using <code><a href='abname.html'>abname</a></code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations to, using <code>abname</code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
</tr>
<tr>
<th>combine_IR</th>
@ -221,13 +221,13 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>These functions are meant to count isolates. Use the <code><a href='portion.html'>portion</a>_*</code> functions to calculate microbial resistance.</p>
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='http://dplyr.tidyverse.org/reference/n_distinct.html'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
<p><code>count_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) and counts the amounts of R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
<p>These functions are meant to count isolates. Use the <code>portion_*</code> functions to calculate microbial resistance.</p>
<p><code>n_rsi</code> is an alias of <code>count_all</code>. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to <code><a href='https://www.rdocumentation.org/packages/dplyr/topics/n_distinct'>n_distinct</a></code>. Their function is equal to <code>count_S(...) + count_IR(...)</code>.</p>
<p><code>count_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code>as.rsi</code>) and counts the amounts of R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='portion.html'>portion</a>_*</code> to calculate microbial resistance and susceptibility.</p></div>
<div class='dont-index'><p><code>portion_*</code> to calculate microbial resistance and susceptibility.</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -251,17 +251,17 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
<span class='co'># calculate back to count e.g. non-susceptible isolates.</span>
<span class='co'># This results in the same:</span>
<span class='fu'>count_IR</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
<span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>) * <span class='fu'>n_rsi</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
<span class='fu'>portion_IR</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>) * <span class='fu'>n_rsi</span>(<span class='no'>septic_patients</span>$<span class='no'>amox</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>count_R</span>(<span class='no'>cipr</span>),
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>count_I</span>(<span class='no'>cipr</span>),
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>count_S</span>(<span class='no'>cipr</span>),
<span class='kw'>n1</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>), <span class='co'># the actual total; sum of all three</span>
<span class='kw'>n2</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># same - analogous to n_distinct</span>
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
<span class='co'># Count co-resistance between amoxicillin/clav acid and gentamicin,</span>
<span class='co'># so we can see that combination therapy does a lot more than mono therapy.</span>
@ -279,13 +279,13 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># It also supports grouping variables</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>count_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># }</span></pre>

View File

@ -199,7 +199,7 @@
</tr>
<tr>
<th>col_mo</th>
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
</tr>
<tr>
<th>info</th>

View File

@ -198,7 +198,7 @@
</tr>
<tr>
<th>col_mo</th>
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
</tr>
<tr>
<th>col_testcode</th>
@ -214,7 +214,7 @@
</tr>
<tr>
<th>col_keyantibiotics</th>
<td><p>column name of the key antibiotics to determine first <em>weighted</em> isolates, see <code><a href='key_antibiotics.html'>key_antibiotics</a></code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this.</p></td>
<td><p>column name of the key antibiotics to determine first <em>weighted</em> isolates, see <code>key_antibiotics</code>. Defaults to the first column that starts with 'key' followed by 'ab' or 'antibiotics' (case insensitive). Use <code>col_keyantibiotics = FALSE</code> to prevent this.</p></td>
</tr>
<tr>
<th>episode_days</th>
@ -291,7 +291,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='key_antibiotics.html'>key_antibiotics</a></code></p></div>
<div class='dont-index'><p><code>key_antibiotics</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -302,11 +302,11 @@ To conduct an analysis of antimicrobial resistance, you should only include the
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='co'># Filter on first isolates:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>)
<span class='co'># Which can be shortened to:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
@ -317,15 +317,15 @@ To conduct an analysis of antimicrobial resistance, you should only include the
<span class='co'># Now let's see if first isolates matter:</span>
<span class='no'>A</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
<span class='no'>B</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'>filter_first_weighted_isolate</span>() <span class='kw'>%&gt;%</span> <span class='co'># the 1st isolate filter</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>count</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>gent</span>), <span class='co'># gentamicin availability</span>
<span class='kw'>resistance</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>gent</span>)) <span class='co'># gentamicin resistance</span>
<span class='co'># Have a look at A and B.</span>
<span class='co'># B is more reliable because every isolate is only counted once.</span>
@ -337,7 +337,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the
<span class='co'># }</span><span class='co'># NOT RUN {</span>
<span class='co'># set key antibiotics to a new variable</span>
<span class='no'>tbl</span>$<span class='no'>keyab</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='key_antibiotics.html'>key_antibiotics</a></span>(<span class='no'>tbl</span>)
<span class='no'>tbl</span>$<span class='no'>keyab</span> <span class='kw'>&lt;-</span> <span class='fu'>key_antibiotics</span>(<span class='no'>tbl</span>)
<span class='no'>tbl</span>$<span class='no'>first_isolate</span> <span class='kw'>&lt;-</span>
<span class='fu'>first_isolate</span>(<span class='no'>tbl</span>)

View File

@ -317,34 +317,34 @@
<span class='co'># you could also use `select` or `pull` to get your variables</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>freq</span>()
<span class='co'># multiple selected variables will be pasted together</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='no'>left_join_microorganisms</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
<span class='co'># group a variable and analyse another</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>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>)
<span class='co'># get top 10 bugs of hospital A as a vector</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>hospital_id</span> <span class='kw'>==</span> <span class='st'>"A"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>freq</span>(<span class='no'>mo</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>top_freq</span>(<span class='fl'>10</span>)
<span class='co'># save frequency table to an object</span>
<span class='no'>years</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'>freq</span>(<span class='no'>year</span>)
@ -395,11 +395,11 @@
<span class='co'># only get selected columns</span>
<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='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>item</span>, <span class='no'>percent</span>)
<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='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(-<span class='no'>count</span>, -<span class='no'>cum_count</span>)
<span class='co'># check differences between frequency tables</span>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Determines the system language to be used for language-dependent output of AMR functions, like <code><a href='mo_property.html'>mo_gramstain</a></code> and <code><a href='mo_property.html'>mo_type</a></code>.</p>
<p>Determines the system language to be used for language-dependent output of AMR functions, like <code>mo_gramstain</code> and <code>mo_type</code>.</p>
</div>

View File

@ -193,11 +193,11 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>data</th>
<td><p>a <code>data.frame</code> with column(s) of class <code>"rsi"</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
<td><p>a <code>data.frame</code> with column(s) of class <code>"rsi"</code> (see <code>as.rsi</code>)</p></td>
</tr>
<tr>
<th>position</th>
<td><p>position adjustment of bars, either <code>"fill"</code> (default when <code>fun</code> is <code><a href='count.html'>count_df</a></code>), <code>"stack"</code> (default when <code>fun</code> is <code><a href='portion.html'>portion_df</a></code>) or <code>"dodge"</code></p></td>
<td><p>position adjustment of bars, either <code>"fill"</code> (default when <code>fun</code> is <code>count_df</code>), <code>"stack"</code> (default when <code>fun</code> is <code>portion_df</code>) or <code>"dodge"</code></p></td>
</tr>
<tr>
<th>x</th>
@ -221,11 +221,11 @@
</tr>
<tr>
<th>translate_ab</th>
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations into, using <code><a href='abname.html'>abname</a></code>. Default behaviour is to translate to official names according to the WHO. Use <code>translate_ab = FALSE</code> to disable translation.</p></td>
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations into, using <code>abname</code>. Default behaviour is to translate to official names according to the WHO. Use <code>translate_ab = FALSE</code> to disable translation.</p></td>
</tr>
<tr>
<th>fun</th>
<td><p>function to transform <code>data</code>, either <code><a href='count.html'>count_df</a></code> (default) or <code><a href='portion.html'>portion_df</a></code></p></td>
<td><p>function to transform <code>data</code>, either <code>count_df</code> (default) or <code>portion_df</code></p></td>
</tr>
<tr>
<th>nrow</th>
@ -251,9 +251,9 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>At default, the names of antibiotics will be shown on the plots using <code><a href='abname.html'>abname</a></code>. This can be set with the option <code>get_antibiotic_names</code> (a logical value), so change it e.g. to <code>FALSE</code> with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>options(get_antibiotic_names = FALSE)</a></code>.</p>
<p>At default, the names of antibiotics will be shown on the plots using <code>abname</code>. This can be set with the option <code>get_antibiotic_names</code> (a logical value), so change it e.g. to <code>FALSE</code> with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>options(get_antibiotic_names = FALSE)</a></code>.</p>
<p><strong>The functions</strong><br />
<code>geom_rsi</code> will take any variable from the data that has an <code>rsi</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) using <code>fun</code> (<code><a href='count.html'>count_df</a></code> at default, can also be <code><a href='portion.html'>portion_df</a></code>) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
<code>geom_rsi</code> will take any variable from the data that has an <code>rsi</code> class (created with <code>as.rsi</code>) using <code>fun</code> (<code>count_df</code> at default, can also be <code>portion_df</code>) and will plot bars with the percentage R, I and S. The default behaviour is to have the bars stacked and to have the different antibiotics on the x axis.</p>
<p><code>facet_rsi</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://ggplot2.tidyverse.org/reference/facet_wrap.html'>facet_wrap</a></code>.</p>
<p><code>scale_y_percent</code> transforms the y axis to a 0 to 100% range using <code>scale_continuous</code>.</p>
<p><code>scale_rsi_colours</code> sets colours to the bars: green for S, yellow for I and red for R, using <code>scale_brewer</code>.</p>
@ -268,7 +268,7 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>ggplot2</span>)
<span class='co'># get antimicrobial results for drugs against a UTI:</span>
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>)) +
<span class='fu'>geom_rsi</span>()
<span class='co'># prettify the plot using some additional functions:</span>
@ -282,17 +282,17 @@
<span class='co'># or better yet, simplify this using the wrapper function - a single command:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>()
<span class='co'># get only portions and no counts:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>fun</span> <span class='kw'>=</span> <span class='no'>portion_df</span>)
<span class='co'># add other ggplot2 parameters as you like:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>width</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"black"</span>,
<span class='kw'>size</span> <span class='kw'>=</span> <span class='fl'>1</span>,
@ -301,25 +301,25 @@
<span class='co'># resistance of ciprofloxacine per age group</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># `age_group` is also a function of this package:</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span>(<span class='no'>age</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>age_group</span>,
<span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
<span class='co'># }</span><span class='co'># NOT RUN {</span>
<span class='co'># for colourblind mode, use divergent colours from the viridis package:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>() + <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
<span class='co'># it also supports groups (don't forget to use the group var on `x` or `facet`):</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>nitr</span>, <span class='no'>fosf</span>, <span class='no'>trim</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>hospital_id</span>,
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>1</span>) +
@ -329,22 +329,22 @@
<span class='co'># genuine analysis: check 2 most prevalent microorganisms</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='co'># create new bacterial ID's, with all CoNS under the same group (Becker et al.)</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># filter on top three bacterial ID's</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'><a href='freq.html'>top_freq</a></span>(<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'>top_freq</span>(<span class='fu'>freq</span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># determine first isolates</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>,
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
<span class='kw'>col_patient_id</span> <span class='kw'>=</span> <span class='st'>"patient_id"</span>,
<span class='kw'>col_mo</span> <span class='kw'>=</span> <span class='st'>"mo"</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># filter on first isolates</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%&gt;%</span>
<span class='co'># get short MO names (like "E. coli")</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'>mo_shortname</span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># select this short name and some antiseptic drugs</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>mo</span>, <span class='no'>cfur</span>, <span class='no'>gent</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='co'># group by MO</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>mo</span>) <span class='kw'>%&gt;%</span>
<span class='co'># plot the thing, putting MOs on the facet</span>
<span class='fu'>ggplot_rsi</span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>Antibiotic</span>,
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>mo</span>,

View File

@ -286,7 +286,7 @@
</tbody><tbody>
<tr>
<th colspan="2">
<h2 id="section-analysing-the-data" class="hasAnchor"><a href="#section-analysing-the-data" class="anchor"></a>Analysing the data</h2>
<h2 id="section-analysing-your-data" class="hasAnchor"><a href="#section-analysing-your-data" class="anchor"></a>Analysing your data</h2>
<p class="section-desc"><p>Functions for conducting AMR analysis</p></p>
</th>
</tr>
@ -436,7 +436,7 @@
<ul class="nav nav-pills nav-stacked">
<li><a href="#section-cleaning-your-data">Cleaning your data</a></li>
<li><a href="#section-adding-variables-to-your-data">Adding variables to your data</a></li>
<li><a href="#section-analysing-the-data">Analysing the data</a></li>
<li><a href="#section-analysing-your-data">Analysing your data</a></li>
<li><a href="#section-included-data-sets">Included data sets</a></li>
<li><a href="#section-other">Other</a></li>
</ul>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Join the dataset <code><a href='microorganisms.html'>microorganisms</a></code> easily to an existing table or character vector.</p>
<p>Join the dataset <code>microorganisms</code> easily to an existing table or character vector.</p>
</div>
@ -188,7 +188,7 @@
</tr>
<tr>
<th>by</th>
<td><p>a variable to join by - if left empty will search for a column with class <code>mo</code> (created with <code><a href='as.mo.html'>as.mo</a></code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (like <code>by = "bacteria_id"</code>), or another column in <code><a href='microorganisms.html'>microorganisms</a></code> (but then it should be named, like <code>by = c("my_genus_species" = "fullname")</code>)</p></td>
<td><p>a variable to join by - if left empty will search for a column with class <code>mo</code> (created with <code>as.mo</code>) or will be <code>"mo"</code> if that column name exists in <code>x</code>, could otherwise be a column name of <code>x</code> with values that exist in <code>microorganisms$mo</code> (like <code>by = "bacteria_id"</code>), or another column in <code>microorganisms</code> (but then it should be named, like <code>by = c("my_genus_species" = "fullname")</code>)</p></td>
</tr>
<tr>
<th>suffix</th>
@ -207,7 +207,7 @@
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># NOT RUN {</span>
<span class='fu'>left_join_microorganisms</span>(<span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"K. pneumoniae"</span>))
<span class='fu'>left_join_microorganisms</span>(<span class='fu'>as.mo</span>(<span class='st'>"K. pneumoniae"</span>))
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"B_KLBSL_PNE"</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
@ -216,7 +216,7 @@
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></span>(<span class='kw'>date</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='kw'>from</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-01"</span>),
<span class='kw'>to</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/as.Date'>as.Date</a></span>(<span class='st'>"2018-01-07"</span>),
<span class='kw'>by</span> <span class='kw'>=</span> <span class='fl'>1</span>),
<span class='kw'>bacteria</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
<span class='kw'>bacteria</span> <span class='kw'>=</span> <span class='fu'>as.mo</span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"S. aureus"</span>, <span class='st'>"MRSA"</span>, <span class='st'>"MSSA"</span>, <span class='st'>"STAAUR"</span>,
<span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>, <span class='st'>"E. coli"</span>)),
<span class='kw'>stringsAsFactors</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/colnames'>colnames</a></span>(<span class='no'>df</span>)

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>These function can be used to determine first isolates (see <code><a href='first_isolate.html'>first_isolate</a></code>). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first <em>weighted</em> isolates.</p>
<p>These function can be used to determine first isolates (see <code>first_isolate</code>). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first <em>weighted</em> isolates.</p>
</div>
@ -187,7 +187,7 @@
</tr>
<tr>
<th>col_mo</th>
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
</tr>
<tr>
<th>universal_1, universal_2, universal_3, universal_4, universal_5, universal_6</th>
@ -233,7 +233,7 @@
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code><a href='first_isolate.html'>first_isolate</a></code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code><a href='first_isolate.html'>first_isolate</a></code>). Without key antibiotic comparison it wouldn't.</p>
<p>The function <code>key_antibiotics</code> returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using <code>key_antibiotics_equal</code>, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (<code>"."</code>). The <code>first_isolate</code> function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible <em>S. aureus</em> (MSSA) found within the same episode (see <code>episode</code> parameter of <code>first_isolate</code>). Without key antibiotic comparison it wouldn't.</p>
<p>At default, the antibiotics that are used for <strong>Gram positive bacteria</strong> are (colum names): <br />
<code>"amox"</code>, <code>"amcl"</code>, <code>"cfur"</code>, <code>"pita"</code>, <code>"cipr"</code>, <code>"trsu"</code> (until here is universal), <code>"vanc"</code>, <code>"teic"</code>, <code>"tetr"</code>, <code>"eryt"</code>, <code>"oxac"</code>, <code>"rifa"</code>.</p>
<p>At default, the antibiotics that are used for <strong>Gram negative bacteria</strong> are (colum names): <br />
@ -251,7 +251,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='first_isolate.html'>first_isolate</a></code></p></div>
<div class='dont-index'><p><code>first_isolate</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -261,12 +261,12 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='co'># set key antibiotics to a new variable</span>
<span class='no'>my_patients</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>keyab</span> <span class='kw'>=</span> <span class='fu'>key_antibiotics</span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(
<span class='co'># now calculate first isolates</span>
<span class='kw'>first_regular</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>),
<span class='kw'>first_regular</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>),
<span class='co'># and first WEIGHTED isolates</span>
<span class='kw'>first_weighted</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='st'>"keyab"</span>)
<span class='kw'>first_weighted</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>, <span class='kw'>col_keyantibiotics</span> <span class='kw'>=</span> <span class='st'>"keyab"</span>)
)
<span class='co'># Check the difference, in this data set it results in 7% more isolates:</span>

View File

@ -193,7 +193,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='skewness.html'>skewness</a></code></p></div>
<div class='dont-index'><p><code>skewness</code></p></div>
</div>

View File

@ -228,9 +228,9 @@
<span class='co'># get frequencies of bacteria whose name start with 'Ent' or 'ent'</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>() <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)
<span class='fu'>left_join_microorganisms</span>() <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -203,7 +203,7 @@
</tr>
<tr>
<th>col_mo</th>
<td><p>column name of the unique IDs of the microorganisms (see <code><a href='as.mo.html'>mo</a></code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code><a href='as.mo.html'>as.mo</a></code>.</p></td>
<td><p>column name of the unique IDs of the microorganisms (see <code>mo</code>), defaults to the first column of class <code>mo</code>. Values will be coerced using <code>as.mo</code>.</p></td>
</tr>
<tr>
<th>info</th>
@ -537,7 +537,7 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>EUCAST</span> <span class='kw'>=</span> <span class='fu'>mdro</span>(<span class='no'>.</span>),
<span class='kw'>BRMO</span> <span class='kw'>=</span> <span class='fu'>brmo</span>(<span class='no'>.</span>))
<span class='co'># }</span></pre>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from <code><a href='microorganisms.html'>microorganisms</a>$mo</code> (using <code><a href='join.html'>left_join_microorganisms</a></code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code><a href='as.mo.html'>guess_mo</a></code>.</p>
<p>A data set containing all bacteria codes of Certe MMB. These codes can be joined to data with an ID from <code>microorganisms$mo</code> (using <code>left_join_microorganisms</code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code>guess_mo</code>.</p>
</div>
@ -173,12 +173,12 @@
<p>A <code><a href='https://www.rdocumentation.org/packages/base/topics/data.frame'>data.frame</a></code> with 2,665 observations and 2 variables:</p><dl class='dl-horizontal'>
<dt><code>certe</code></dt><dd><p>Code of microorganism according to Certe MMB</p></dd>
<dt><code>mo</code></dt><dd><p>Code of microorganism in <code><a href='microorganisms.html'>microorganisms</a></code></p></dd>
<dt><code>mo</code></dt><dd><p>Code of microorganism in <code>microorganisms</code></p></dd>
</dl>
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code> <code>microorganisms</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using <code><a href='as.mo.html'>as.mo</a></code>.</p>
<p>A data set containing the complete microbial taxonomy of the kingdoms Bacteria, Fungi and Protozoa. MO codes can be looked up using <code>as.mo</code>.</p>
</div>
@ -185,7 +185,7 @@
<dt><code>subkingdom</code></dt><dd><p>Taxonomic subkingdom of the microorganism as found in ITIS, see Source</p></dd>
<dt><code>kingdom</code></dt><dd><p>Taxonomic kingdom of the microorganism as found in ITIS, see Source</p></dd>
<dt><code>gramstain</code></dt><dd><p>Gram of microorganism, like <code>"Gram negative"</code></p></dd>
<dt><code>prevalence</code></dt><dd><p>An integer based on estimated prevalence of the microorganism in humans. Used internally by <code><a href='as.mo.html'>as.mo</a></code>, otherwise quite meaningless. It has a value of 25 for manually added items and a value of 1000 for all unprevalent microorganisms whose genus was somewhere in the top 250 (with another species).</p></dd>
<dt><code>prevalence</code></dt><dd><p>An integer based on estimated prevalence of the microorganism in humans. Used internally by <code>as.mo</code>, otherwise quite meaningless. It has a value of 25 for manually added items and a value of 1000 for all unprevalent microorganisms whose genus was somewhere in the top 250 (with another species).</p></dd>
<dt><code>ref</code></dt><dd><p>Author(s) and year of concerning publication as found in ITIS, see Source</p></dd>
</dl>
@ -203,7 +203,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='mo_property.html'>mo_property</a></code> <code><a href='microorganisms.umcg.html'>microorganisms.umcg</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code> <code>mo_property</code> <code>microorganisms.umcg</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by <code><a href='as.mo.html'>as.mo</a></code>.</p>
<p>A data set containing old (previously valid or accepted) taxonomic names according to ITIS. This data set is used internally by <code>as.mo</code>.</p>
</div>
@ -192,7 +192,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='mo_property.html'>mo_property</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code> <code>mo_property</code> <code>microorganisms</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from <code><a href='microorganisms.html'>microorganisms</a>$mo</code> (using <code><a href='join.html'>left_join_microorganisms</a></code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code><a href='as.mo.html'>guess_mo</a></code>.</p>
<p>A data set containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from <code>microorganisms$mo</code> (using <code>left_join_microorganisms</code>). GLIMS codes can also be translated to valid <code>MO</code>s with <code>guess_mo</code>.</p>
</div>
@ -178,7 +178,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code> <code><a href='microorganisms.certe.html'>microorganisms.certe</a></code> <code><a href='microorganisms.html'>microorganisms</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code> <code>microorganisms.certe</code> <code>microorganisms</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Returns a vector of all failed attempts to coerce values to a valid MO code with <code><a href='as.mo.html'>as.mo</a></code>.</p>
<p>Returns a vector of all failed attempts to coerce values to a valid MO code with <code>as.mo</code>.</p>
</div>
@ -171,7 +171,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code></p></div>
</div>

View File

@ -163,19 +163,19 @@
<div class="ref-description">
<p>Use these functions to return a specific property of a microorganism from the <code><a href='microorganisms.html'>microorganisms</a></code> data set. All input values will be evaluated internally with <code><a href='as.mo.html'>as.mo</a></code>.</p>
<p>Use these functions to return a specific property of a microorganism from the <code>microorganisms</code> data set. All input values will be evaluated internally with <code>as.mo</code>.</p>
</div>
<pre class="usage"><span class='fu'>mo_fullname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<pre class="usage"><span class='fu'>mo_fullname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_shortname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_shortname</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_subspecies</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_subspecies</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_species</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_species</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_genus</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_genus</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_family</span>(<span class='no'>x</span>, <span class='no'>...</span>)
@ -189,9 +189,9 @@
<span class='fu'>mo_kingdom</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>mo_type</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_type</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_gramstain</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)
<span class='fu'>mo_gramstain</span>(<span class='no'>x</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)
<span class='fu'>mo_TSN</span>(<span class='no'>x</span>, <span class='no'>...</span>)
@ -203,26 +203,26 @@
<span class='fu'>mo_taxonomy</span>(<span class='no'>x</span>, <span class='no'>...</span>)
<span class='fu'>mo_property</span>(<span class='no'>x</span>, <span class='kw'>property</span> <span class='kw'>=</span> <span class='st'>"fullname"</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='get_locale.html'>get_locale</a></span>(), <span class='no'>...</span>)</pre>
<span class='fu'>mo_property</span>(<span class='no'>x</span>, <span class='kw'>property</span> <span class='kw'>=</span> <span class='st'>"fullname"</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'>get_locale</span>(), <span class='no'>...</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>x</th>
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.mo.html'>as.mo</a></code></p></td>
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code>as.mo</code></p></td>
</tr>
<tr>
<th>language</th>
<td><p>language of the returned text, defaults to system language (see <code><a href='get_locale.html'>get_locale</a></code>) and can also be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("AMR_locale")</code>. Use <code>language = NULL</code> or <code>language = ""</code> to prevent translation.</p></td>
<td><p>language of the returned text, defaults to system language (see <code>get_locale</code>) and can also be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("AMR_locale")</code>. Use <code>language = NULL</code> or <code>language = ""</code> to prevent translation.</p></td>
</tr>
<tr>
<th>...</th>
<td><p>other parameters passed on to <code><a href='as.mo.html'>as.mo</a></code></p></td>
<td><p>other parameters passed on to <code>as.mo</code></p></td>
</tr>
<tr>
<th>property</th>
<td><p>one of the column names of one of the <code><a href='microorganisms.html'>microorganisms</a></code> data set or <code>"shortname"</code></p></td>
<td><p>one of the column names of one of the <code>microorganisms</code> data set or <code>"shortname"</code></p></td>
</tr>
</table>
@ -266,7 +266,7 @@ This package contains the <strong>complete microbial taxonomic data</strong> (wi
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='microorganisms.html'>microorganisms</a></code></p></div>
<div class='dont-index'><p><code>microorganisms</code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>Returns a vector of all renamed items of the last coercion to valid MO codes with <code><a href='as.mo.html'>as.mo</a></code>.</p>
<p>Returns a vector of all renamed items of the last coercion to valid MO codes with <code>as.mo</code>.</p>
</div>
@ -171,7 +171,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='as.mo.html'>as.mo</a></code></p></div>
<div class='dont-index'><p><code>as.mo</code></p></div>
</div>

View File

@ -192,7 +192,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>...</th>
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See Examples.</p></td>
<td><p>one or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with <code>as.rsi</code> if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See Examples.</p></td>
</tr>
<tr>
<th>minimum</th>
@ -208,11 +208,11 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
</tr>
<tr>
<th>data</th>
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>)</p></td>
<td><p>a <code>data.frame</code> containing columns with class <code>rsi</code> (see <code>as.rsi</code>)</p></td>
</tr>
<tr>
<th>translate_ab</th>
<td><p>a column name of the <code><a href='antibiotics.html'>antibiotics</a></code> data set to translate the antibiotic abbreviations to, using <code><a href='abname.html'>abname</a></code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
<td><p>a column name of the <code>antibiotics</code> data set to translate the antibiotic abbreviations to, using <code>abname</code>. This can be set with <code><a href='https://www.rdocumentation.org/packages/base/topics/options'>getOption</a>("get_antibiotic_names")</code>.</p></td>
</tr>
<tr>
<th>combine_IR</th>
@ -231,10 +231,10 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p><strong>Remember that you should filter your table to let it contain only first isolates!</strong> Use <code><a href='first_isolate.html'>first_isolate</a></code> to determine them in your data set.</p>
<p>These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the <code><a href='count.html'>count</a></code> functions to count isolates. <em>Low counts can infuence the outcome - these <code>portion</code> functions may camouflage this, since they only return the portion albeit being dependent on the <code>minimum</code> parameter.</em></p>
<p><code>portion_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code><a href='as.rsi.html'>as.rsi</a></code>) and calculates the portions R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
<p>The old <code><a href='rsi.html'>rsi</a></code> function is still available for backwards compatibility but is deprecated.
<p><strong>Remember that you should filter your table to let it contain only first isolates!</strong> Use <code>first_isolate</code> to determine them in your data set.</p>
<p>These functions are not meant to count isolates, but to calculate the portion of resistance/susceptibility. Use the <code><a href='https://www.rdocumentation.org/packages/dplyr/topics/tally'>count</a></code> functions to count isolates. <em>Low counts can infuence the outcome - these <code>portion</code> functions may camouflage this, since they only return the portion albeit being dependent on the <code>minimum</code> parameter.</em></p>
<p><code>portion_df</code> takes any variable from <code>data</code> that has an <code>"rsi"</code> class (created with <code>as.rsi</code>) and calculates the portions R, I and S. The resulting <em>tidy data</em> (see Source) <code>data.frame</code> will have three rows (S/I/R) and a column for each variable with class <code>"rsi"</code>.</p>
<p>The old <code>rsi</code> function is still available for backwards compatibility but is deprecated.
<br /><br />
To calculate the probability (<em>p</em>) of susceptibility of one antibiotic, we use this formula:
<div style="text-align: center"><img src='figures/mono_therapy.png' alt='' /></div>
@ -250,7 +250,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='count.html'>count</a>_*</code> to count resistant and susceptible isolates.</p></div>
<div class='dont-index'><p><code><a href='https://www.rdocumentation.org/packages/dplyr/topics/tally'>count</a>_*</code> to count resistant and susceptible isolates.</p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -274,58 +274,58 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>portion_SI</span>(<span class='no'>amox</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>)) <span class='co'># n_rsi works like n_distinct in dplyr</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>),
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>)) <span class='co'># n_rsi works like n_distinct in dplyr</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>R</span> <span class='kw'>=</span> <span class='fu'>portion_R</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>I</span> <span class='kw'>=</span> <span class='fu'>portion_I</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>S</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>cipr</span>), <span class='co'># works like n_distinct in dplyr</span>
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='http://dplyr.tidyverse.org/reference/n.html'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>cipr</span>), <span class='co'># works like n_distinct in dplyr</span>
<span class='kw'>total</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/n'>n</a></span>()) <span class='co'># NOT the amount of tested isolates!</span>
<span class='co'># Calculate co-resistance between amoxicillin/clav acid and gentamicin,</span>
<span class='co'># so we can see that combination therapy does a lot more than mono therapy:</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>) <span class='co'># S = 67.1%</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amcl</span>) <span class='co'># n = 1576</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>count_all</span>(<span class='no'>amcl</span>) <span class='co'># n = 1576</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>) <span class='co'># S = 74.0%</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>gent</span>) <span class='co'># n = 1855</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>count_all</span>(<span class='no'>gent</span>) <span class='co'># n = 1855</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>portion_S</span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># S = 92.0%</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># n = 1517</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'>count_all</span>(<span class='no'>amcl</span>, <span class='no'>gent</span>) <span class='co'># n = 1517</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>cipro_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>cipr</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>cipro_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>cipro_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>),
<span class='kw'>genta_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>genta_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>gent</span>),
<span class='kw'>genta_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>gent</span>),
<span class='kw'>combination_p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>cipr</span>, <span class='no'>gent</span>, <span class='kw'>as_percent</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>),
<span class='kw'>combination_n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>cipr</span>, <span class='no'>gent</span>))
<span class='kw'>combination_n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>cipr</span>, <span class='no'>gent</span>))
<span class='co'># Get portions S/I/R immediately of all rsi columns</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># It also supports grouping variables</span>
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='https://www.rdocumentation.org/packages/dplyr/topics/select'>select</a></span>(<span class='no'>hospital_id</span>, <span class='no'>amox</span>, <span class='no'>cipr</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>portion_df</span>(<span class='kw'>translate</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='co'># }</span><span class='co'># NOT RUN {</span>
<span class='co'># calculate current empiric combination therapy of Helicobacter gastritis:</span>
<span class='no'>my_table</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Helicobacter"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>count_all</a></span>(<span class='no'>amox</span>, <span class='no'>metr</span>))
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_S</span>(<span class='no'>amox</span>, <span class='no'>metr</span>), <span class='co'># amoxicillin with metronidazole</span>
<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>count_all</span>(<span class='no'>amox</span>, <span class='no'>metr</span>))
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>This function is only useful for the MMB department of the UMCG. Use this function to <strong>import data by just defining the <code>file</code> parameter</strong>. It will automatically transform birth dates and calculate patients age, translate the column names to English, transform the MO codes with <code><a href='as.mo.html'>as.mo</a></code> and transform all antimicrobial columns with <code><a href='as.rsi.html'>as.rsi</a></code>.</p>
<p>This function is only useful for the MMB department of the UMCG. Use this function to <strong>import data by just defining the <code>file</code> parameter</strong>. It will automatically transform birth dates and calculate patients age, translate the column names to English, transform the MO codes with <code>as.mo</code> and transform all antimicrobial columns with <code>as.rsi</code>.</p>
</div>

View File

@ -240,7 +240,7 @@
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p>The <code><a href='portion.html'>portion</a></code> function to calculate resistance, <br /> <code><a href='https://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></code> <code><a href='https://www.rdocumentation.org/packages/stats/topics/glm'>glm</a></code></p></div>
<div class='dont-index'><p>The <code>portion</code> function to calculate resistance, <br /> <code><a href='https://www.rdocumentation.org/packages/stats/topics/lm'>lm</a></code> <code><a href='https://www.rdocumentation.org/packages/stats/topics/glm'>glm</a></code></p></div>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
@ -252,7 +252,7 @@
<span class='co'># or use dplyr so you can actually read it:</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>tbl</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>,
<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Haemophilus"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>resistance_predict</span>(<span class='no'>amcl</span>, <span class='no'>date</span>)
<span class='co'># }</span><span class='co'># NOT RUN {</span>
@ -261,11 +261,11 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='co'># get bacteria properties like genus and species</span>
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>(<span class='st'>"mo"</span>) <span class='kw'>%&gt;%</span>
<span class='fu'>left_join_microorganisms</span>(<span class='st'>"mo"</span>) <span class='kw'>%&gt;%</span>
<span class='co'># calculate first isolates</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolate</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>.</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># filter on first E. coli isolates</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>==</span> <span class='st'>"Escherichia"</span>,
<span class='no'>species</span> <span class='kw'>==</span> <span class='st'>"coli"</span>,
<span class='no'>first_isolate</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%&gt;%</span>
<span class='co'># predict resistance of cefotaxime for next years</span>
@ -279,7 +279,7 @@
<span class='kw'>if</span> (!<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>require</a></span>(<span class='no'>ggplot2</span>)) {
<span class='no'>data</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>as.mo</span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'>resistance_predict</span>(<span class='kw'>col_ab</span> <span class='kw'>=</span> <span class='st'>"amox"</span>,
<span class='kw'>col_date</span> <span class='kw'>=</span> <span class='st'>"date"</span>,
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>This function is deprecated. Use the <code><a href='portion.html'>portion</a></code> functions instead.</p>
<p>This function is deprecated. Use the <code>portion</code> functions instead.</p>
</div>
@ -175,7 +175,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>ab1, ab2</th>
<td><p>vector (or column) with antibiotic interpretations. It will be transformed internally with <code><a href='as.rsi.html'>as.rsi</a></code> if needed.</p></td>
<td><p>vector (or column) with antibiotic interpretations. It will be transformed internally with <code>as.rsi</code> if needed.</p></td>
</tr>
<tr>
<th>interpretation</th>

View File

@ -180,8 +180,8 @@
<dt><code>age</code></dt><dd><p>age of the patient</p></dd>
<dt><code>gender</code></dt><dd><p>gender of the patient</p></dd>
<dt><code>patient_id</code></dt><dd><p>ID of the patient, first 10 characters of an SHA hash containing irretrievable information</p></dd>
<dt><code>mo</code></dt><dd><p>ID of microorganism created with <code><a href='as.mo.html'>as.mo</a></code>, see also <code><a href='microorganisms.html'>microorganisms</a></code></p></dd>
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code><a href='as.rsi.html'>as.rsi</a></code>); these column names occur in <code><a href='antibiotics.html'>antibiotics</a></code> data set and can be translated with <code><a href='abname.html'>abname</a></code></p></dd>
<dt><code>mo</code></dt><dd><p>ID of microorganism created with <code>as.mo</code>, see also <code>microorganisms</code></p></dd>
<dt><code>peni:rifa</code></dt><dd><p>40 different antibiotics with class <code>rsi</code> (see <code>as.rsi</code>); these column names occur in <code>antibiotics</code> data set and can be translated with <code>abname</code></p></dd>
</dl>
@ -199,7 +199,7 @@
<span class='co'># Add first isolates to our data set:</span>
<span class='no'>my_data</span> <span class='kw'>&lt;-</span> <span class='no'>my_data</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>first_isolates</span> <span class='kw'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span>(<span class='no'>my_data</span>, <span class='st'>"date"</span>, <span class='st'>"patient_id"</span>, <span class='st'>"mo"</span>))
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/mutate'>mutate</a></span>(<span class='kw'>first_isolates</span> <span class='kw'>=</span> <span class='fu'>first_isolate</span>(<span class='no'>my_data</span>, <span class='st'>"date"</span>, <span class='st'>"patient_id"</span>, <span class='st'>"mo"</span>))
<span class='co'># -------- #</span>
<span class='co'># ANALYSIS #</span>
@ -209,22 +209,22 @@
<span class='co'># and numbers (n) of E. coli, divided by hospital:</span>
<span class='no'>my_data</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>guess_mo</a></span>(<span class='st'>"E. coli"</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>guess_mo</span>(<span class='st'>"E. coli"</span>),
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://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'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>amox</span>),
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>amox</span>))
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='no'>hospital_id</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>amox</span>),
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>amox</span>))
<span class='co'># 2. Get the amoxicillin/clavulanic acid resistance</span>
<span class='co'># percentages of E. coli, trend over the years:</span>
<span class='no'>my_data</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>guess_mo</a></span>(<span class='st'>"E. coli"</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/filter'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'>guess_mo</span>(<span class='st'>"E. coli"</span>),
<span class='no'>first_isolates</span> <span class='kw'>==</span> <span class='fl'>TRUE</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='http://dplyr.tidyverse.org/reference/summarise.html'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'><a href='count.html'>n_rsi</a></span>(<span class='no'>amcl</span>),
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'><a href='portion.html'>portion_IR</a></span>(<span class='no'>amcl</span>, <span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>20</span>))
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/group_by'>group_by</a></span>(<span class='kw'>year</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/format'>format</a></span>(<span class='no'>date</span>, <span class='st'>"%Y"</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/dplyr/topics/summarise'>summarise</a></span>(<span class='kw'>n</span> <span class='kw'>=</span> <span class='fu'>n_rsi</span>(<span class='no'>amcl</span>),
<span class='kw'>p</span> <span class='kw'>=</span> <span class='fu'>portion_IR</span>(<span class='no'>amcl</span>, <span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>20</span>))
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -195,7 +195,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
<h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>
<div class='dont-index'><p><code><a href='kurtosis.html'>kurtosis</a></code></p></div>
<div class='dont-index'><p><code>kurtosis</code></p></div>
</div>

View File

@ -163,7 +163,7 @@
<div class="ref-description">
<p>These <code>data.tables</code> are transformed from the <code><a href='microorganisms.html'>microorganisms</a></code> and <code><a href='microorganisms.html'>microorganisms</a></code> data sets to improve speed of <code><a href='as.mo.html'>as.mo</a></code>. They are meant for internal use only, and are only mentioned here for reference.</p>
<p>These <code>data.tables</code> are transformed from the <code>microorganisms</code> and <code>microorganisms</code> data sets to improve speed of <code>as.mo</code>. They are meant for internal use only, and are only mentioned here for reference.</p>
</div>

View File

@ -123,7 +123,4 @@
<url>
<loc>https://msberends.gitlab.io/articles/AMR.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/articles/freq.html</loc>
</url>
</urlset>

View File

@ -2,8 +2,10 @@
$('head').append('<!-- Updated Font Awesome library --><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">');
/* edit footer */
$('footer').html('<p>' +
$('footer .copyright p').html().replace("Developed by",
"<code>AMR</code> (for R). Developed at the University of Groningen.<br>Authors:") +
'</p>');
$( document ).ready(function() {
$('footer').html('<p>' +
$('footer .copyright p').html().replace("Developed by",
"<code>AMR</code> (for R). Developed at the University of Groningen.<br>Authors:") +
'</p>');
//$('footer').prepend("<div class='university'/>");
});