1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 20:06:12 +01:00
This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-03-27 11:22:36 +01:00
parent 8a1d384d9c
commit 429814c29b
77 changed files with 488 additions and 489 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.5.0.9025
Date: 2019-03-26
Version: 0.6.0
Date: 2019-03-27
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

View File

@ -1,5 +1,4 @@
# AMR 0.5.0.90xx
**Note: this is the development version, which will eventually be released as AMR 0.6.0.**
# AMR 0.6.0
**New website!**
@ -11,7 +10,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
#### New
* **BREAKING**: removed deprecated functions, parameters and references to 'bactid'. Use `as.mo()` to identify an MO code.
* Catalogue of Life as a new taxonomic source for data about microorganisms, which also contains all ITIS data we used previously. The `microorganisms` data set now contains:
* All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses
* All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa
* All ~3,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales and Schizosaccharomycetales (covering at least like all species of *Aspergillus*, *Candida*, *Pneumocystis*, *Saccharomyces* and *Trichophyton*)
* All ~2,000 (sub)species from ~100 other relevant genera, from the kingdoms of Animalia and Plantae (like *Strongyloides* and *Taenia*)
* All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed
@ -122,7 +121,8 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
as.mo(..., allow_uncertain = 0)
```
Using `as.mo(..., allow_uncertain = 3)` could lead to very unreliable results.
* All microbial IDs that are found with zero uncertainty are now saved to a local file `~/.Rhistory_mo`. Use the new function `clean_mo_history()` to delete this file, which resets the algorithms.
* Implemented the latest publication of Becker *et al.* (2019), for categorising coagulase-negative *Staphylococci*
* All microbial IDs that found are now saved to a local file `~/.Rhistory_mo`. Use the new function `clean_mo_history()` to delete this file, which resets the algorithms.
* Incoercible results will now be considered 'unknown', MO code `UNKNOWN`. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:
```r
mo_genus("qwerty", language = "es")

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">26 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -201,7 +201,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 26 March 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 27 March 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -217,21 +217,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-03-26</td>
<td align="center">2019-03-27</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2019-03-26</td>
<td align="center">2019-03-27</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2019-03-26</td>
<td align="center">2019-03-27</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -327,71 +327,71 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2014-08-13</td>
<td align="center">C5</td>
<td align="center">2015-10-28</td>
<td align="center">A4</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2011-07-22</td>
<td align="center">Y8</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2014-09-30</td>
<td align="center">N3</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-02-14</td>
<td align="center">Z6</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2015-02-01</td>
<td align="center">D5</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2017-11-08</td>
<td align="center">R4</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2015-01-27</td>
<td align="center">U9</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-09-17</td>
<td align="center">R7</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2017-04-07</td>
<td align="center">Z10</td>
<td align="center">2013-12-28</td>
<td align="center">V6</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2015-08-27</td>
<td align="center">C7</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
</tbody>
</table>
<p>Now, lets start the cleaning and the analysis!</p>
@ -411,8 +411,8 @@
#&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,435 52.2% 10,435 52.2%
#&gt; 2 F 9,565 47.8% 20,000 100.0%</code></pre>
#&gt; 1 M 10,344 51.7% 10,344 51.7%
#&gt; 2 F 9,656 48.3% 20,000 100.0%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didnt already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -443,10 +443,10 @@
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Kingella kingae (no changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1262 changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1342 changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; Table 3: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2756 changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2726 changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 9: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)</span></a>
@ -462,9 +462,9 @@
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,403 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,400 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; -&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,018 test results (0 to S; 0 to I; 4,018 to R)</span></a></code></pre></div>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,068 test results (0 to S; 0 to I; 4,068 to R)</span></a></code></pre></div>
</div>
<div id="adding-new-variables" class="section level1">
<h1 class="hasAnchor">
@ -489,8 +489,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" title="4"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" title="5"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,648 first isolates (28.2% of total)</span></a></code></pre></div>
<p>So only 28.2% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,665 first isolates (28.3% of total)</span></a></code></pre></div>
<p>So only 28.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -516,111 +516,111 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-29</td>
<td align="center">P7</td>
<td align="center">2010-09-11</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-05-18</td>
<td align="center">P7</td>
<td align="center">2010-11-07</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-01</td>
<td align="center">P7</td>
<td align="center">2011-01-16</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-07-21</td>
<td align="center">P7</td>
<td align="center">2011-02-25</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-08-20</td>
<td align="center">P7</td>
<td align="center">2011-08-07</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-12-14</td>
<td align="center">P7</td>
<td align="center">2011-08-16</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-03-02</td>
<td align="center">P7</td>
<td align="center">2011-10-08</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-03-14</td>
<td align="center">P7</td>
<td align="center">2011-10-26</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-05-28</td>
<td align="center">P7</td>
<td align="center">2012-01-15</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-08-09</td>
<td align="center">P7</td>
<td align="center">2012-02-08</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
@ -637,7 +637,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" title="8"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" title="9"><span class="co">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,891 first weighted isolates (79.5% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,729 first weighted isolates (78.6% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -654,11 +654,11 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-29</td>
<td align="center">P7</td>
<td align="center">2010-09-11</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
@ -666,35 +666,35 @@
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-05-18</td>
<td align="center">P7</td>
<td align="center">2010-11-07</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-01</td>
<td align="center">P7</td>
<td align="center">2011-01-16</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-07-21</td>
<td align="center">P7</td>
<td align="center">2011-02-25</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -702,83 +702,83 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-08-20</td>
<td align="center">P7</td>
<td align="center">2011-08-07</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-12-14</td>
<td align="center">P7</td>
<td align="center">2011-08-16</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-03-02</td>
<td align="center">P7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-10-08</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-03-14</td>
<td align="center">P7</td>
<td align="center">2011-10-26</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-05-28</td>
<td align="center">P7</td>
<td align="center">2012-01-15</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-08-09</td>
<td align="center">P7</td>
<td align="center">2012-02-08</td>
<td align="center">L7</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Instead of 2, now 8 isolates are flagged. In total, 79.5% of all isolates are marked first weighted - 51.2% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>Instead of 2, now 10 isolates are flagged. In total, 78.6% of all isolates are marked first weighted - 50.3% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,891 isolates for analysis.</p>
<p>So we end up with 15,729 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
@ -786,7 +786,6 @@
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th></th>
<th align="center">date</th>
<th align="center">patient_id</th>
<th align="center">hospital</th>
@ -803,15 +802,14 @@
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2014-08-13</td>
<td align="center">C5</td>
<td align="center">Hospital C</td>
<td align="center">2015-10-28</td>
<td align="center">A4</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
@ -819,13 +817,42 @@
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>4</td>
<td align="center">2010-09-17</td>
<td align="center">R7</td>
<td align="center">2011-07-22</td>
<td align="center">Y8</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2014-09-30</td>
<td align="center">N3</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-02-14</td>
<td align="center">Z6</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
@ -835,14 +862,28 @@
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>5</td>
<td align="center">2017-04-07</td>
<td align="center">Z10</td>
<td align="center">2015-02-01</td>
<td align="center">D5</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-12-28</td>
<td align="center">V6</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram positive</td>
@ -850,54 +891,6 @@
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>7</td>
<td align="center">2012-04-03</td>
<td align="center">J2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>9</td>
<td align="center">2017-09-09</td>
<td align="center">U3</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>10</td>
<td align="center">2015-12-21</td>
<td align="center">E1</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Time for the analysis!</p>
@ -915,9 +908,9 @@
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div>
<p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,891 x 13)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,729 x 13)</strong></p>
<p>Columns: 2<br>
Length: 15,891 (of which NA: 0 = 0.00%)<br>
Length: 15,729 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -934,33 +927,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,952</td>
<td align="right">50.0%</td>
<td align="right">7,952</td>
<td align="right">50.0%</td>
<td align="right">7,807</td>
<td align="right">49.6%</td>
<td align="right">7,807</td>
<td align="right">49.6%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,895</td>
<td align="right">24.5%</td>
<td align="right">11,847</td>
<td align="right">3,919</td>
<td align="right">24.9%</td>
<td align="right">11,726</td>
<td align="right">74.6%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,502</td>
<td align="right">15.7%</td>
<td align="right">14,349</td>
<td align="right">90.3%</td>
<td align="right">2,426</td>
<td align="right">15.4%</td>
<td align="right">14,152</td>
<td align="right">90.0%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,542</td>
<td align="right">9.7%</td>
<td align="right">15,891</td>
<td align="right">1,577</td>
<td align="right">10.0%</td>
<td align="right">15,729</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -971,7 +964,7 @@ Longest: 24</p>
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4711472</span></a></code></pre></div>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4796236</span></a></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -984,19 +977,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4674370</td>
<td align="center">0.4841779</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4698925</td>
<td align="center">0.4800215</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4813574</td>
<td align="center">0.4663419</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4712389</td>
<td align="center">0.4815057</td>
</tr>
</tbody>
</table>
@ -1014,23 +1007,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4674370</td>
<td align="center">4760</td>
<td align="center">0.4841779</td>
<td align="center">4835</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4698925</td>
<td align="center">5580</td>
<td align="center">0.4800215</td>
<td align="center">5581</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4813574</td>
<td align="center">2387</td>
<td align="center">0.4663419</td>
<td align="center">2258</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4712389</td>
<td align="center">3164</td>
<td align="center">0.4815057</td>
<td align="center">3055</td>
</tr>
</tbody>
</table>
@ -1050,27 +1043,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7272384</td>
<td align="center">0.9034205</td>
<td align="center">0.9763581</td>
<td align="center">0.7376713</td>
<td align="center">0.8986807</td>
<td align="center">0.9754067</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.7457847</td>
<td align="center">0.9014267</td>
<td align="center">0.9760052</td>
<td align="center">0.7305010</td>
<td align="center">0.8953710</td>
<td align="center">0.9727330</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7245186</td>
<td align="center">0.9181001</td>
<td align="center">0.9756098</td>
<td align="center">0.7305435</td>
<td align="center">0.9275325</td>
<td align="center">0.9793315</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.7234213</td>
<td align="center">0.7320692</td>
<td align="center">0.0000000</td>
<td align="center">0.7234213</td>
<td align="center">0.7320692</td>
</tr>
</tbody>
</table>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to use the <em>G</em>-test</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>G_test.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>SPSS.Rmd</code></div>
@ -213,7 +213,7 @@
<ul>
<li>
<p><strong>R is highly modular.</strong></p>
<p>The <a href="https://cran.r-project.org/web/packages/">official R network (CRAN)</a> features almost 14,000 packages at the time of writing, our <code>AMR</code> package being one of them. All these packages were peer-reviewed before publication. Aside from this official channel, there are also developers who choose not to submit to CRAN, but rather keep it on their own public repository, like GitLab or GitHub. So there may even be a lot more than 14,000 packages out there.</p>
<p>The <a href="https://cran.r-project.org/">official R network (CRAN)</a> features almost 14,000 packages at the time of writing, our <code>AMR</code> package being one of them. All these packages were peer-reviewed before publication. Aside from this official channel, there are also developers who choose not to submit to CRAN, but rather keep it on their own public repository, like GitLab or GitHub. So there may even be a lot more than 14,000 packages out there.</p>
<p>Bottom line is, you can really extend it yourself or ask somebody to do this for you. Take for example our <code>AMR</code> package. Among other things, it adds reliable reference data to R to help you with the data cleaning and analysis. SPSS, SAS and Stata will never know what a valid MIC value is or what the Gram stain of <em>E. coli</em> is. Or that all species of <em>Klebiella</em> are resistant to amoxicillin and that Floxapen<sup>®</sup> is a trade name of flucloxacillin. These facts and properties are often needed to clean existing data, which would be very inconvenient in a software package without reliable reference data. See below for a demonstration.</p>
</li>
<li>
@ -227,17 +227,17 @@
</li>
<li>
<p><strong>R has a huge community.</strong></p>
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, more than <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">275,000 R-related questions</a> have already been asked on this platform (which covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
<p>Many R users just ask questions on websites like <a href="https://stackoverflow.com">StackOverflow.com</a>, the largest online community for programmers. At the time of writing, almost <a href="https://stackoverflow.com/questions/tagged/r?sort=votes">300,000 R-related questions</a> have already been asked on this platform (which covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.</p>
</li>
<li>
<p><strong>R understands any data type, including SPSS/SAS/Stata.</strong></p>
<p>And thats not vice versa Im afraid. You can import data from any source into R. As said, from SPSS/SAS/Stata (<a href="https://haven.tidyverse.org/">link</a>), but also from Excel (<a href="https://readxl.tidyverse.org/">link</a>), from flat files like CSV, TXT or TSV (<a href="https://readr.tidyverse.org/">link</a>), or directly from databases or datawarehouses from anywhere on the world (<a href="https://dbplyr.tidyverse.org/">link</a>). You can even scrape websites to download tables that are live on the internet (<a href="https://github.com/hadley/rvest">link</a>).</p>
<p>And the best part - you can export from R to all data formats as well. So you can import an SPSS file, do your analysis neatly in R and export back to SPSS. Although you might omit that very last step.</p>
<p>And thats not vice versa Im afraid. You can import data from any source into R. From SPSS, SAS and Stata (<a href="https://haven.tidyverse.org/">link</a>), from Minitab, Epi Info and EpiData (<a href="https://cran.r-project.org/package=foreign">link</a>), from Excel (<a href="https://readxl.tidyverse.org/">link</a>), from flat files like CSV, TXT or TSV (<a href="https://readr.tidyverse.org/">link</a>), or directly from databases and datawarehouses from anywhere on the world (<a href="https://dbplyr.tidyverse.org/">link</a>). You can even scrape websites to download tables that are live on the internet (<a href="https://github.com/hadley/rvest">link</a>).</p>
<p>And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files.</p>
</li>
<li>
<p><strong>R is completely free and open-source.</strong></p>
<p>No strings attached. It was created and is being maintained by volunteers who believe that (data) science should be open and publicly available to everybody. SPSS, SAS and Stata are quite expensive. IBM SPSS Staticstics only comes with subscriptions nowadays, varying <a href="https://www.ibm.com/products/spss-statistics/pricing">between USD 1,300 and USD 8,500</a> per computer <em>per year</em>. SAS Analytics Pro costs <a href="https://www.sas.com/store/products-solutions/sas-analytics-pro/prodPERSANL.html">around USD 10,000</a> per computer. Stata also has a business model with subscription fees, varying <a href="https://www.stata.com/order/new/bus/single-user-licenses/dl/">between USD 600 and USD 1,200</a> per computer per year, but lower prices come with a limitation of the number of variables you can work with.</p>
<p>If you are working at a midsized or small company, you can save it tens of thousands of dollars by using R instead of SPSS - gaining even more functions and flexibility. And all R enthousiasts can do as much PR as they want (like I do here), because nobody is officially associated with or affiliated by R. It is really free.</p>
<p>If you are working at a midsized or small company, you can save it tens of thousands of dollars by using R instead of e.g. SPSS - gaining even more functions and flexibility. And all R enthousiasts can do as much PR as they want (like I do here), because nobody is officially associated with or affiliated by R. It is really free.</p>
</li>
</ul>
<p>If you sometimes write syntaxes in SPSS to run a complete analysis or to automate some of your work, you should perhaps do this in R. You will notice that writing syntaxes in R is a lot more nifty and clever than in SPSS.</p>
@ -280,7 +280,7 @@
<div id="rstudio" class="section level3">
<h3 class="hasAnchor">
<a href="#rstudio" class="anchor"></a>RStudio</h3>
<p>To work with R, probably the best option is to use <a href="https://www.rstudio.com/products/rstudio/">RStudio</a>. It is an open-source and free desktop environment which not only allows you to run R code, but also supports project management, version management, package management and convenient import menus to work with other data sources. You can also run <a href="https://www.rstudio.com/products/rstudio/">RStudio Server</a>, which is nothing less than the complete RStudio software available as a website (e.g. in your corporate network or at home).</p>
<p>To work with R, probably the best option is to use <a href="https://www.rstudio.com/products/rstudio/">RStudio</a>. It is an open-source and free desktop environment which not only allows you to run R code, but also supports project management, version management, package management and convenient import menus to work with other data sources. You can also install <a href="https://www.rstudio.com/products/rstudio/">RStudio Server</a> on a private or corporate server, which brings nothing less than the complete RStudio software to you as a website (at home or at work).</p>
<p>To import a data file, just click <em>Import Dataset</em> in the Environment tab:</p>
<p><img src="https://gitlab.com/msberends/AMR/raw/master/docs/import1.png"></p>
<p>If additional packages are needed, RStudio will ask you if they should be installed on beforehand.</p>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div>
@ -234,10 +234,10 @@
<p><strong>Frequency table of <code>mo</code> from a <code>data.frame</code> (500 x 54)</strong></p>
<p>Class: <code>mo</code> (<code>character</code>)<br>
Length: 500 (of which NA: 0 = 0.00%)<br>
Unique: 37</p>
Unique: 39</p>
<p>Families: 10<br>
Genera: 17<br>
Species: 35</p>
Species: 38</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>
@ -258,7 +258,7 @@ Species: 35</p>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">B_STPHY</td>
<td align="left">B_STPHY_CNS</td>
<td align="right">74</td>
<td align="right">14.8%</td>
<td align="right">319</td>
@ -314,33 +314,34 @@ Species: 35</p>
</tr>
<tr class="odd">
<td align="left">9</td>
<td align="left">B_STRPT</td>
<td align="right">8</td>
<td align="right">1.6%</td>
<td align="right">442</td>
<td align="right">88.4%</td>
</tr>
<tr class="even">
<td align="left">10</td>
<td align="left">B_ENTRB_CLO</td>
<td align="right">5</td>
<td align="right">1.0%</td>
<td align="right">447</td>
<td align="right">89.4%</td>
<td align="right">439</td>
<td align="right">87.8%</td>
</tr>
<tr class="even">
<td align="left">10</td>
<td align="left">B_ENTRC_COL</td>
<td align="right">4</td>
<td align="right">0.8%</td>
<td align="right">443</td>
<td align="right">88.6%</td>
</tr>
</tbody>
</table>
<p>(omitted 27 entries, n = 53 [10.6%])</p>
<p>(omitted 29 entries, n = 57 [11.4%])</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"></a>
<a class="sourceLine" id="cb5-2" title="2"><span class="co"># our transformed antibiotic columns</span></a>
<a class="sourceLine" id="cb5-3" title="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
<a class="sourceLine" id="cb5-4" title="4">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div>
<p><strong>Frequency table of <code>AMC_ND2</code> from a <code>data.frame</code> (500 x 54)</strong></p>
<pre><code># Warning: These values could not be coerced to a valid atc: "AMCND".</code></pre>
<p>Class: <code>factor</code> &gt; <code>ordered</code> &gt; <code>rsi</code> (<code>numeric</code>)<br>
Length: 500 (of which NA: 19 = 3.80%)<br>
Levels: 3: <code>S</code> &lt; <code>I</code> &lt; <code>R</code><br>
Unique: 3</p>
<p>%IR: 25.00% (ratio 2.8:1)</p>
<p>%IR: 25.99%</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to get properties of an antibiotic</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>atc_property.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9024</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">18 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -218,13 +218,13 @@
<a class="sourceLine" id="cb2-9" title="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb2-10" title="10"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#&gt; as.mo("sau") 18.0 18.0 22 18.0 18.0 61 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 49.0 50.0 62 50.0 50.0 130 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 18.0 18.0 27 18.0 18.0 66 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 18.0 18.0 23 18.0 19.0 66 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 29.0 29.0 39 29.0 42.0 73 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 29.0 29.0 38 29.0 31.0 72 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 8.3 8.3 12 8.3 8.8 44 10</span></a></code></pre></div>
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#&gt; as.mo("sau") 18.0 18.0 22 18.0 20.0 48 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 48.0 48.0 76 67.0 92.0 150 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 18.0 18.0 24 19.0 22.0 62 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 18.0 18.0 23 18.0 20.0 61 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 29.0 29.0 35 29.0 30.0 76 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 29.0 29.0 37 29.0 30.0 79 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 8.2 8.2 13 8.2 8.4 52 10</span></a></code></pre></div>
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">T.islandicus &lt;-<span class="st"> </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>(<span class="st">"theisl"</span>),</a>
@ -236,12 +236,12 @@
<a class="sourceLine" id="cb3-7" title="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-8" title="8"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-9" title="9"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#&gt; as.mo("theisl") 470 470 490 470 510 520 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 470 470 500 500 520 530 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 74 74 84 75 77 130 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 74 74 84 74 75 120 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 74 78 100 120 120 130 10</span></a></code></pre></div>
<p>That takes 7.9 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#&gt; as.mo("theisl") 460 460 500 510 510 560 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 460 470 490 490 510 530 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 74 74 84 75 78 120 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 74 75 88 75 120 120 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 73 73 84 74 75 130 10</span></a></code></pre></div>
<p>That takes 7.6 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
<a class="sourceLine" id="cb4-2" title="2"></a>
@ -257,6 +257,7 @@
<a class="sourceLine" id="cb4-12" title="12"> <span class="dt">main =</span> <span class="st">"Benchmarks per prevalence"</span>)</a></code></pre></div>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
<p>In reality, the <code><a href="../reference/as.mo.html">as.mo()</a></code> functions <strong>learns from its own output to speed up determinations for next times</strong>. In above figure, this effect was disabled to show the difference with the boxplot below - when you would use <code><a href="../reference/as.mo.html">as.mo()</a></code> yourself:</p>
<pre><code>#&gt; File /home/uscloud/.Rhistory_mo removed.</code></pre>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="720"></p>
<p>The highest outliers are the first times. All next determinations were done in only thousands of seconds.</p>
<p>Still, uncommon microorganisms take a lot more time than common microorganisms, especially the first time. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
@ -264,103 +265,103 @@
<h3 class="hasAnchor">
<a href="#repetitive-results" class="anchor"></a>Repetitive results</h3>
<p>Repetitive results are unique values that are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_fullname()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb5-2" title="2"><span class="co"># take all MO codes from the septic_patients data set</span></a>
<a class="sourceLine" id="cb5-3" title="3">x &lt;-<span class="st"> </span>septic_patients<span class="op">$</span>mo <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-4" title="4"><span class="st"> </span><span class="co"># keep only the unique ones</span></a>
<a class="sourceLine" id="cb5-5" title="5"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unique">unique</a></span>() <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-6" title="6"><span class="st"> </span><span class="co"># pick 50 of them at random</span></a>
<a class="sourceLine" id="cb5-7" title="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-8" title="8"><span class="st"> </span><span class="co"># paste that 10,000 times</span></a>
<a class="sourceLine" id="cb5-9" title="9"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-10" title="10"><span class="st"> </span><span class="co"># scramble it</span></a>
<a class="sourceLine" id="cb5-11" title="11"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</a>
<a class="sourceLine" id="cb5-12" title="12"> </a>
<a class="sourceLine" id="cb5-13" title="13"><span class="co"># got indeed 50 times 10,000 = half a million?</span></a>
<a class="sourceLine" id="cb5-14" title="14"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/length">length</a></span>(x)</a>
<a class="sourceLine" id="cb5-15" title="15"><span class="co">#&gt; [1] 500000</span></a>
<a class="sourceLine" id="cb5-16" title="16"></a>
<a class="sourceLine" id="cb5-17" title="17"><span class="co"># and how many unique values do we have?</span></a>
<a class="sourceLine" id="cb5-18" title="18"><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</a>
<a class="sourceLine" id="cb5-19" title="19"><span class="co">#&gt; [1] 50</span></a>
<a class="sourceLine" id="cb5-20" title="20"></a>
<a class="sourceLine" id="cb5-21" title="21"><span class="co"># now let's see:</span></a>
<a class="sourceLine" id="cb5-22" title="22">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(x),</a>
<a class="sourceLine" id="cb5-23" title="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb5-24" title="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb5-25" title="25"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#&gt; mo_fullname(x) 770 811 822 817 824 952 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.82 seconds (816 ms). You only lose time on your unique input values.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a>
<a class="sourceLine" id="cb6-2" title="2"><span class="co"># take all MO codes from the septic_patients data set</span></a>
<a class="sourceLine" id="cb6-3" title="3">x &lt;-<span class="st"> </span>septic_patients<span class="op">$</span>mo <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="st"> </span><span class="co"># keep only the unique ones</span></a>
<a class="sourceLine" id="cb6-5" title="5"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/unique">unique</a></span>() <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-6" title="6"><span class="st"> </span><span class="co"># pick 50 of them at random</span></a>
<a class="sourceLine" id="cb6-7" title="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-8" title="8"><span class="st"> </span><span class="co"># paste that 10,000 times</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="st"> </span><span class="co"># scramble it</span></a>
<a class="sourceLine" id="cb6-11" title="11"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</a>
<a class="sourceLine" id="cb6-12" title="12"> </a>
<a class="sourceLine" id="cb6-13" title="13"><span class="co"># got indeed 50 times 10,000 = half a million?</span></a>
<a class="sourceLine" id="cb6-14" title="14"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/length">length</a></span>(x)</a>
<a class="sourceLine" id="cb6-15" title="15"><span class="co">#&gt; [1] 500000</span></a>
<a class="sourceLine" id="cb6-16" title="16"></a>
<a class="sourceLine" id="cb6-17" title="17"><span class="co"># and how many unique values do we have?</span></a>
<a class="sourceLine" id="cb6-18" title="18"><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</a>
<a class="sourceLine" id="cb6-19" title="19"><span class="co">#&gt; [1] 50</span></a>
<a class="sourceLine" id="cb6-20" title="20"></a>
<a class="sourceLine" id="cb6-21" title="21"><span class="co"># now let's see:</span></a>
<a class="sourceLine" id="cb6-22" title="22">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(x),</a>
<a class="sourceLine" id="cb6-23" title="23"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb6-24" title="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb6-25" title="25"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-26" title="26"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-27" title="27"><span class="co">#&gt; mo_fullname(x) 825 845 887 867 903 1080 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.87 seconds (867 ms). You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
<a href="#precalculated-results" class="anchor"></a>Precalculated results</h3>
<p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_fullname()</a></code>, it almost doesnt take any time at all (see C below):</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a>
<a class="sourceLine" id="cb6-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. aureus"</span>),</a>
<a class="sourceLine" id="cb6-3" title="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
<a class="sourceLine" id="cb6-4" title="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb6-5" title="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb6-6" title="6"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#&gt; A 12.000 12.600 12.900 13.200 13.200 13.300 10</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#&gt; B 26.100 26.200 27.200 26.600 28.100 30.400 10</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#&gt; C 0.394 0.738 0.745 0.774 0.869 0.982 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
<a class="sourceLine" id="cb7-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"B_STPHY_AUR"</span>),</a>
<a class="sourceLine" id="cb7-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. aureus"</span>),</a>
<a class="sourceLine" id="cb7-3" title="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
<a class="sourceLine" id="cb7-4" title="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a>
<a class="sourceLine" id="cb7-5" title="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a>
<a class="sourceLine" id="cb7-6" title="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a>
<a class="sourceLine" id="cb7-7" title="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a>
<a class="sourceLine" id="cb7-8" title="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a>
<a class="sourceLine" id="cb7-9" title="9"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb7-10" title="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb7-11" title="11"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-12" title="12"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#&gt; A 0.316 0.382 0.407 0.430 0.434 0.457 10</span></a>
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#&gt; B 0.371 0.470 0.497 0.498 0.548 0.579 10</span></a>
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#&gt; C 0.410 0.465 0.662 0.606 0.851 0.944 10</span></a>
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#&gt; D 0.366 0.376 0.406 0.393 0.429 0.493 10</span></a>
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#&gt; E 0.301 0.318 0.374 0.350 0.426 0.476 10</span></a>
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#&gt; F 0.304 0.331 0.387 0.392 0.438 0.482 10</span></a>
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#&gt; G 0.303 0.331 0.381 0.374 0.432 0.473 10</span></a>
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#&gt; H 0.316 0.374 0.430 0.399 0.443 0.709 10</span></a></code></pre></div>
<a class="sourceLine" id="cb7-4" title="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb7-5" title="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb7-6" title="6"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-7" title="7"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-8" title="8"><span class="co">#&gt; A 12.400 12.700 13.100 13.000 13.400 13.700 10</span></a>
<a class="sourceLine" id="cb7-9" title="9"><span class="co">#&gt; B 26.300 26.600 27.900 28.400 28.700 29.000 10</span></a>
<a class="sourceLine" id="cb7-10" title="10"><span class="co">#&gt; C 0.486 0.502 0.727 0.821 0.849 0.982 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
<a class="sourceLine" id="cb8-2" title="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
<a class="sourceLine" id="cb8-3" title="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
<a class="sourceLine" id="cb8-4" title="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a>
<a class="sourceLine" id="cb8-5" title="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a>
<a class="sourceLine" id="cb8-6" title="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a>
<a class="sourceLine" id="cb8-7" title="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a>
<a class="sourceLine" id="cb8-8" title="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a>
<a class="sourceLine" id="cb8-9" title="9"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb8-10" title="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb8-11" title="11"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb8-12" title="12"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb8-13" title="13"><span class="co">#&gt; A 0.371 0.432 0.463 0.471 0.500 0.525 10</span></a>
<a class="sourceLine" id="cb8-14" title="14"><span class="co">#&gt; B 0.479 0.531 0.557 0.553 0.566 0.631 10</span></a>
<a class="sourceLine" id="cb8-15" title="15"><span class="co">#&gt; C 0.511 0.676 0.834 0.904 0.959 1.090 10</span></a>
<a class="sourceLine" id="cb8-16" title="16"><span class="co">#&gt; D 0.422 0.444 0.483 0.494 0.501 0.559 10</span></a>
<a class="sourceLine" id="cb8-17" title="17"><span class="co">#&gt; E 0.383 0.458 0.502 0.477 0.507 0.778 10</span></a>
<a class="sourceLine" id="cb8-18" title="18"><span class="co">#&gt; F 0.362 0.376 0.476 0.426 0.473 0.947 10</span></a>
<a class="sourceLine" id="cb8-19" title="19"><span class="co">#&gt; G 0.361 0.368 0.451 0.452 0.500 0.610 10</span></a>
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#&gt; H 0.359 0.383 0.431 0.437 0.458 0.505 10</span></a></code></pre></div>
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package knows all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
</div>
<div id="results-in-other-languages" class="section level3">
<h3 class="hasAnchor">
<a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3>
<p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost doest take extra time:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_fullname("CoNS") on an English system</span></a>
<a class="sourceLine" id="cb8-2" title="2"><span class="co">#&gt; [1] "Coagulase-negative Staphylococcus (CoNS)"</span></a>
<a class="sourceLine" id="cb8-3" title="3"></a>
<a class="sourceLine" id="cb8-4" title="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_fullname("CoNS") on a Spanish system</span></a>
<a class="sourceLine" id="cb8-5" title="5"><span class="co">#&gt; [1] "Staphylococcus coagulasa negativo (CoNS)"</span></a>
<a class="sourceLine" id="cb8-6" title="6"></a>
<a class="sourceLine" id="cb8-7" title="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_fullname("CoNS") on a Dutch system</span></a>
<a class="sourceLine" id="cb8-8" title="8"><span class="co">#&gt; [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></a>
<a class="sourceLine" id="cb8-9" title="9"></a>
<a class="sourceLine" id="cb8-10" title="10">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a>
<a class="sourceLine" id="cb8-11" title="11"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a>
<a class="sourceLine" id="cb8-12" title="12"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a>
<a class="sourceLine" id="cb8-13" title="13"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a>
<a class="sourceLine" id="cb8-14" title="14"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a>
<a class="sourceLine" id="cb8-15" title="15"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a>
<a class="sourceLine" id="cb8-16" title="16"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a>
<a class="sourceLine" id="cb8-17" title="17"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb8-18" title="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
<a class="sourceLine" id="cb8-19" title="19"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#&gt; en 19.22 19.33 20.42 19.58 19.84 28.13 10</span></a>
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#&gt; de 31.28 31.62 41.16 32.79 34.86 75.79 10</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#&gt; nl 31.56 31.71 36.86 31.97 33.34 78.40 10</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#&gt; es 31.32 31.94 42.76 32.98 41.72 81.33 10</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#&gt; it 31.31 31.67 31.96 31.90 32.15 33.26 10</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#&gt; fr 31.09 31.43 37.49 32.53 33.73 75.53 10</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#&gt; pt 31.24 31.82 36.35 31.95 32.12 76.57 10</span></a></code></pre></div>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_fullname("CoNS") on an English system</span></a>
<a class="sourceLine" id="cb9-2" title="2"><span class="co">#&gt; [1] "Coagulase-negative Staphylococcus (CoNS)"</span></a>
<a class="sourceLine" id="cb9-3" title="3"></a>
<a class="sourceLine" id="cb9-4" title="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_fullname("CoNS") on a Spanish system</span></a>
<a class="sourceLine" id="cb9-5" title="5"><span class="co">#&gt; [1] "Staphylococcus coagulasa negativo (SCN)"</span></a>
<a class="sourceLine" id="cb9-6" title="6"></a>
<a class="sourceLine" id="cb9-7" title="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_fullname("CoNS") on a Dutch system</span></a>
<a class="sourceLine" id="cb9-8" title="8"><span class="co">#&gt; [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></a>
<a class="sourceLine" id="cb9-9" title="9"></a>
<a class="sourceLine" id="cb9-10" title="10">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a>
<a class="sourceLine" id="cb9-11" title="11"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a>
<a class="sourceLine" id="cb9-12" title="12"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a>
<a class="sourceLine" id="cb9-13" title="13"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a>
<a class="sourceLine" id="cb9-14" title="14"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a>
<a class="sourceLine" id="cb9-15" title="15"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a>
<a class="sourceLine" id="cb9-16" title="16"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a>
<a class="sourceLine" id="cb9-17" title="17"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb9-18" title="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
<a class="sourceLine" id="cb9-19" title="19"><span class="co">#&gt; Unit: milliseconds</span></a>
<a class="sourceLine" id="cb9-20" title="20"><span class="co">#&gt; expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb9-21" title="21"><span class="co">#&gt; en 18.83 19.19 24.20 19.53 20.67 63.66 10</span></a>
<a class="sourceLine" id="cb9-22" title="22"><span class="co">#&gt; de 31.53 32.10 36.79 32.22 33.81 75.80 10</span></a>
<a class="sourceLine" id="cb9-23" title="23"><span class="co">#&gt; nl 31.24 31.78 32.22 32.10 32.24 33.43 10</span></a>
<a class="sourceLine" id="cb9-24" title="24"><span class="co">#&gt; es 31.40 32.07 45.82 33.08 75.31 76.95 10</span></a>
<a class="sourceLine" id="cb9-25" title="25"><span class="co">#&gt; it 31.17 31.95 36.82 32.09 32.19 79.48 10</span></a>
<a class="sourceLine" id="cb9-26" title="26"><span class="co">#&gt; fr 31.48 31.64 31.89 31.96 32.07 32.33 10</span></a>
<a class="sourceLine" id="cb9-27" title="27"><span class="co">#&gt; pt 31.27 31.66 36.80 32.06 32.34 80.53 10</span></a></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to create frequency tables</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>freq.Rmd</code></div>
@ -258,16 +258,17 @@ Longest: 1</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/colnames">colnames</a></span>(microorganisms)</a>
<a class="sourceLine" id="cb3-2" title="2"><span class="co"># [1] "mo" "col_id" "fullname" "kingdom" "phylum" </span></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="co"># [6] "class" "order" "family" "genus" "species" </span></a>
<a class="sourceLine" id="cb3-4" title="4"><span class="co"># [11] "subspecies" "rank" "ref" "species_id"</span></a></code></pre></div>
<p>If we compare the dimensions between the old and new dataset, we can see that these 13 variables were added:</p>
<a class="sourceLine" id="cb3-4" title="4"><span class="co"># [11] "subspecies" "rank" "ref" "species_id" "source" </span></a>
<a class="sourceLine" id="cb3-5" title="5"><span class="co"># [16] "prevalence"</span></a></code></pre></div>
<p>If we compare the dimensions between the old and new dataset, we can see that these 15 variables were added:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/dim">dim</a></span>(septic_patients)</a>
<a class="sourceLine" id="cb4-2" title="2"><span class="co"># [1] 2000 49</span></a>
<a class="sourceLine" id="cb4-3" title="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/dim">dim</a></span>(my_patients)</a>
<a class="sourceLine" id="cb4-4" title="4"><span class="co"># [1] 2000 62</span></a></code></pre></div>
<a class="sourceLine" id="cb4-4" title="4"><span class="co"># [1] 2000 64</span></a></code></pre></div>
<p>So now the <code>genus</code> and <code>species</code> variables are available. A frequency table of these combined variables can be created like this:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1">my_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb5-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species, <span class="dt">nmax =</span> <span class="dv">15</span>)</a></code></pre></div>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (2,000 x 62)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (2,000 x 64)</strong></p>
<p>Columns: 2<br>
Length: 2,000 (of which NA: 0 = 0.00%)<br>
Unique: 95</p>
@ -293,7 +294,7 @@ Longest: 34</p>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus coagulase negative</td>
<td align="left">Staphylococcus coagulase-negative</td>
<td align="right">313</td>
<td align="right">15.7%</td>
<td align="right">780</td>
@ -604,7 +605,8 @@ Unique: 4</p>
Length: 2,000 (of which NA: 771 = 38.55%)<br>
Levels: 3: <code>S</code> &lt; <code>I</code> &lt; <code>R</code><br>
Unique: 3</p>
<p>%IR: 34.30% (ratio 1:1.3)</p>
<p>Drug: Amoxicillin<br>
%IR: 55.82%</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>
@ -735,7 +737,8 @@ Median: 31 July 2009 (47.39%)</p>
Length: 2,000 (of which NA: 771 = 38.55%)<br>
Levels: 3: <code>S</code> &lt; <code>I</code> &lt; <code>R</code><br>
Unique: 4</p>
<p>%IR: 34.30% (ratio 1:1.3)</p>
<p>Drug: Amoxicillin<br>
%IR: 55.82%</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to get properties of a microorganism</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>mo_property.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -192,7 +192,7 @@
<h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 March 2019</h4>
<h4 class="date">27 March 2019</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -42,7 +42,7 @@ $( document ).ready(function() {
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="../../AMR/cover_r4ds.png" height="100px">' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
@ -53,7 +53,7 @@ $( document ).ready(function() {
'<p>' + $('footer .copyright p').html().replace(
"Developed by",
'<code>AMR</code> (for R). Developed at the <a href="https://www.rug.nl" target="_blank">University of Groningen</a>.<br>Authors:') + '</p>' +
'<a href="https://www.rug.nl" target="_blank"><img src="../../AMR/logo_rug.png" class="footer_logo"></a>' +
'<a href="https://www.rug.nl" target="_blank"><img src="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'</div>');
// doctoral titles of authors

View File

@ -42,7 +42,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -197,7 +197,7 @@
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
<hr>
<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 Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. It supports any data format, including WHONET/EARS-Net data.</p>
<p>After installing this package, R knows ~65,000 microorganisms and ~500 antibiotics by name and code, and knows all about valid RSI and MIC values.</p>
<p>After installing this package, R knows <a href="./reference/microorganisms.html"><strong>~65,000 microorganisms</strong></a> and <a href="./reference/antibiotics.html"><strong>~500 antibiotics</strong></a> by name and code, and knows all about valid RSI and MIC values.</p>
<p><strong>Used to SPSS?</strong> Read our <a href="./articles/SPSS.html">tutorial on how to import data from SPSS, SAS or Stata</a> and learn in which ways R outclasses any of these statistical packages.</p>
<p>We created this package for both academic research and routine analysis at the Faculty of Medical Sciences of the University of Groningen, the Netherlands, and the Medical Microbiology &amp; Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and is free software; you can freely use and distribute it for both personal and commercial (but <strong>not</strong> patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation. Read the full license <a href="./LICENSE-text.html">here</a>.</p>
<p>This package can be used for:</p>
@ -275,7 +275,7 @@
<p>This package contains the complete taxonomic tree of almost all microorganisms from the authoritative and comprehensive Catalogue of Life (<a href="http://www.catalogueoflife.org">www.catalogueoflife.org</a>).</p>
<p>Included are:</p>
<ul>
<li><p>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses</p></li>
<li><p>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa</p></li>
<li>
<p>All ~3,500 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales.</p>
<p>The kingdom of Fungi is a very large taxon with almost 300,000 different (sub)species, of which most are not microbial (but rather macroscopic, like mushrooms). Because of this, not all fungi fit the scope of this package and including everything would tremendously slow down our algorithms too. By only including the aforementioned taxonomic orders, the most relevant fungi are covered (like all species of <em>Aspergillus</em>, <em>Candida</em>, <em>Cryptococcus</em>, <em>Histoplasma</em>, <em>Pneumocystis</em>, <em>Saccharomyces</em> and <em>Trichophyton</em>).</p>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -232,11 +232,10 @@
</div>
<div id="amr-05090xx" class="section level1">
<div id="amr-060" class="section level1">
<h1 class="page-header">
<a href="#amr-05090xx" class="anchor"></a>AMR 0.5.0.90xx<small> Unreleased </small>
<a href="#amr-060" class="anchor"></a>AMR 0.6.0<small> Unreleased </small>
</h1>
<p><strong>Note: this is the development version, which will eventually be released as AMR 0.6.0.</strong></p>
<p><strong>New website!</strong></p>
<p>Weve got a new website: <a href="https://msberends.gitlab.io/AMR/">https://msberends.gitlab.io/AMR</a> (built with the great <a href="https://pkgdown.r-lib.org/"><code>pkgdown</code></a>)</p>
<ul>
@ -251,7 +250,7 @@
<strong>BREAKING</strong>: removed deprecated functions, parameters and references to bactid. Use <code><a href="../reference/as.mo.html">as.mo()</a></code> to identify an MO code.</li>
<li>Catalogue of Life as a new taxonomic source for data about microorganisms, which also contains all ITIS data we used previously. The <code>microorganisms</code> data set now contains:
<ul>
<li>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses</li>
<li>All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa</li>
<li>All ~3,000 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales and Schizosaccharomycetales (covering at least like all species of <em>Aspergillus</em>, <em>Candida</em>, <em>Pneumocystis</em>, <em>Saccharomyces</em> and <em>Trichophyton</em>)</li>
<li>All ~2,000 (sub)species from ~100 other relevant genera, from the kingdoms of Animalia and Plantae (like <em>Strongyloides</em> and <em>Taenia</em>)</li>
<li>All ~15,000 previously accepted names of included (sub)species that have been taxonomically renamed</li>
@ -369,7 +368,9 @@ These functions use <code><a href="../reference/as.atc.html">as.atc()</a></code>
<a class="sourceLine" id="cb8-6" title="6"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb8-7" title="7"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">0</span>)</a></code></pre></div>
Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a></code> could lead to very unreliable results.</li>
<li>All microbial IDs that are found with zero uncertainty are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code><a href="../reference/as.mo.html">clean_mo_history()</a></code> to delete this file, which resets the algorithms.</li>
<li>Implemented the latest publication of Becker <em>et al.</em> (2019), for categorising coagulase-negative <em>Staphylococci</em>
</li>
<li>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code><a href="../reference/as.mo.html">clean_mo_history()</a></code> to delete this file, which resets the algorithms.</li>
<li>
<p>Incoercible results will now be considered unknown, MO code <code>UNKNOWN</code>. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
@ -948,7 +949,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-05090xx">0.5.0.90</a></li>
<li><a href="#amr-060">0.6.0</a></li>
<li><a href="#amr-050">0.5.0</a></li>
<li><a href="#amr-040">0.4.0</a></li>
<li><a href="#amr-030">0.3.0</a></li>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ top_freq can be used to get the top/bottom n items of a frequency table, with co
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -237,7 +237,7 @@
<div class="ref-description">
<p>Use these functions to create bar plots for antimicrobial resistance analysis. All functions rely on internal <code><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></code> functions.</p>
<p>Use these functions to create bar plots for antimicrobial resistance analysis. All functions rely on internal <code><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggplot'>ggplot</a></code> functions.</p>
</div>
@ -328,11 +328,11 @@
<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><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>
<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>facet_rsi</code> creates 2d plots (at default based on S/I/R) using <code><a href='https://www.rdocumentation.org/packages/ggplot2/topics/facet_wrap'>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>
<p><code>theme_rsi</code> is a <code>ggplot <a href='https://ggplot2.tidyverse.org/reference/theme.html'>theme</a></code> with minimal distraction.</p>
<p><code>labels_rsi_count</code> print datalabels on the bars with percentage and amount of isolates using <code><a href='https://ggplot2.tidyverse.org/reference/geom_text.html'>geom_text</a></code></p>
<p><code>theme_rsi</code> is a <code>ggplot <a href='https://www.rdocumentation.org/packages/ggplot2/topics/theme'>theme</a></code> with minimal distraction.</p>
<p><code>labels_rsi_count</code> print datalabels on the bars with percentage and amount of isolates using <code><a href='https://www.rdocumentation.org/packages/ggplot2/topics/geom_text'>geom_text</a></code></p>
<p><code>ggplot_rsi</code> is a wrapper around all above functions that uses data as first input. This makes it possible to use this function after a pipe (<code>%&gt;%</code>). See Examples.</p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
@ -347,12 +347,12 @@
<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='https://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://www.rdocumentation.org/packages/ggplot2/topics/ggplot'>ggplot</a></span>(<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>amox</span>, <span class='no'>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>
<span class='no'>df</span> <span class='kw'>&lt;-</span> <span class='no'>septic_patients</span>[, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"amox"</span>, <span class='st'>"nitr"</span>, <span class='st'>"fosf"</span>, <span class='st'>"trim"</span>, <span class='st'>"cipr"</span>)]
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>df</span>) +
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggplot'>ggplot</a></span>(<span class='no'>df</span>) +
<span class='fu'>geom_rsi</span>() +
<span class='fu'>scale_y_percent</span>() +
<span class='fu'>scale_rsi_colours</span>() +
@ -392,7 +392,7 @@
<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='https://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'>ggplot_rsi</span>() + <span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_viridis.html'>scale_fill_viridis_d</a></span>()
<span class='fu'>ggplot_rsi</span>() + <span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/scale_viridis'>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>
@ -402,7 +402,7 @@
<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>) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"AMR of Anti-UTI Drugs Per Hospital"</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/labs'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"AMR of Anti-UTI Drugs Per Hospital"</span>,
<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Hospital"</span>)
<span class='co'># genuine analysis: check 2 most prevalent microorganisms</span>
@ -429,7 +429,7 @@
<span class='kw'>facet</span> <span class='kw'>=</span> <span class='no'>mo</span>,
<span class='kw'>translate_ab</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='fl'>1</span>) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"AMR of Top Three Microorganisms In Blood Culture Isolates"</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/labs'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='st'>"AMR of Top Three Microorganisms In Blood Culture Isolates"</span>,
<span class='kw'>subtitle</span> <span class='kw'>=</span> <span class='st'>"Only First Isolates, CoNS grouped according to Becker et al. (2014)"</span>,
<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Microorganisms"</span>)
<span class='co'># }</span></pre>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>
@ -385,21 +385,21 @@
<span class='kw'>info</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
<span class='kw'>minimum</span> <span class='kw'>=</span> <span class='fl'>15</span>)
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot</a></span>(<span class='no'>data</span>,
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>year</span>)) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_bar.html'>geom_col</a></span>(<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>y</span> <span class='kw'>=</span> <span class='no'>value</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggplot'>ggplot</a></span>(<span class='no'>data</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='no'>year</span>)) +
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/geom_bar'>geom_col</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>y</span> <span class='kw'>=</span> <span class='no'>value</span>),
<span class='kw'>fill</span> <span class='kw'>=</span> <span class='st'>"grey75"</span>) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/geom_linerange.html'>geom_errorbar</a></span>(<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/aes.html'>aes</a></span>(<span class='kw'>ymin</span> <span class='kw'>=</span> <span class='no'>se_min</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/geom_linerange'>geom_errorbar</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/aes'>aes</a></span>(<span class='kw'>ymin</span> <span class='kw'>=</span> <span class='no'>se_min</span>,
<span class='kw'>ymax</span> <span class='kw'>=</span> <span class='no'>se_max</span>),
<span class='kw'>colour</span> <span class='kw'>=</span> <span class='st'>"grey50"</span>) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/scale_continuous.html'>scale_y_continuous</a></span>(<span class='kw'>limits</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>),
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/scale_continuous'>scale_y_continuous</a></span>(<span class='kw'>limits</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>),
<span class='kw'>breaks</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span>),
<span class='kw'>labels</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste0</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>100</span>, <span class='fl'>10</span>), <span class='st'>"%"</span>)) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/labs.html'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/expression'>expression</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Forecast of amoxicillin resistance in "</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/labs'>labs</a></span>(<span class='kw'>title</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/expression'>expression</a></span>(<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/paste'>paste</a></span>(<span class='st'>"Forecast of amoxicillin resistance in "</span>,
<span class='fu'><a href='https://www.rdocumentation.org/packages/grDevices/topics/plotmath'>italic</a></span>(<span class='st'>"E. coli"</span>))),
<span class='kw'>y</span> <span class='kw'>=</span> <span class='st'>"%IR"</span>,
<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Year"</span>) +
<span class='fu'><a href='https://ggplot2.tidyverse.org/reference/ggtheme.html'>theme_minimal</a></span>(<span class='kw'>base_size</span> <span class='kw'>=</span> <span class='fl'>13</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/ggplot2/topics/ggtheme'>theme_minimal</a></span>(<span class='kw'>base_size</span> <span class='kw'>=</span> <span class='fl'>13</span>)
}
<span class='co'># }</span></pre>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9025</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.5.0.9023</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.0</span>
</span>
</div>

View File

@ -6,7 +6,7 @@
`AMR` is a free and open-source [R package](https://www.r-project.org) to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. It supports any data format, including WHONET/EARS-Net data.
After installing this package, R knows ~65,000 microorganisms and ~500 antibiotics by name and code, and knows all about valid RSI and MIC values.
After installing this package, R knows [**~65,000 microorganisms**](./reference/microorganisms.html) and [**~500 antibiotics**](./reference/antibiotics.html) by name and code, and knows all about valid RSI and MIC values.
**Used to SPSS?** Read our [tutorial on how to import data from SPSS, SAS or Stata](./articles/SPSS.html) and learn in which ways R outclasses any of these statistical packages.
@ -90,7 +90,7 @@ This package contains the complete taxonomic tree of almost all microorganisms f
Included are:
* All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria, Protozoa and Viruses
* All ~55,000 (sub)species from the kingdoms of Archaea, Bacteria and Protozoa
* All ~3,500 (sub)species from these orders of the kingdom of Fungi: Eurotiales, Onygenales, Pneumocystales, Saccharomycetales, Schizosaccharomycetales and Tremellales.

View File

@ -42,7 +42,7 @@ $( document ).ready(function() {
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="../../AMR/cover_r4ds.png" height="100px">' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
@ -53,7 +53,7 @@ $( document ).ready(function() {
'<p>' + $('footer .copyright p').html().replace(
"Developed by",
'<code>AMR</code> (for R). Developed at the <a href="https://www.rug.nl" target="_blank">University of Groningen</a>.<br>Authors:') + '</p>' +
'<a href="https://www.rug.nl" target="_blank"><img src="../../AMR/logo_rug.png" class="footer_logo"></a>' +
'<a href="https://www.rug.nl" target="_blank"><img src="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'</div>');
// doctoral titles of authors

View File

@ -23,7 +23,7 @@ knitr::opts_chunk$set(
)
```
**Note:** values on this page will change with every website update since they are based on randomly created values and the page was written in [RMarkdown](https://rmarkdown.rstudio.com/). However, the methodology remains unchanged. This page was generated on `r format(Sys.Date(), "%d %B %Y")`.
**Note:** values on this page will change with every website update since they are based on randomly created values and the page was written in [R Markdown](https://rmarkdown.rstudio.com/). However, the methodology remains unchanged. This page was generated on `r format(Sys.Date(), "%d %B %Y")`.
# Introduction

View File

@ -33,7 +33,7 @@ As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major
* **R is highly modular.**
The [official R network (CRAN)](https://cran.r-project.org/web/packages/) features almost 14,000 packages at the time of writing, our `AMR` package being one of them. All these packages were peer-reviewed before publication. Aside from this official channel, there are also developers who choose not to submit to CRAN, but rather keep it on their own public repository, like GitLab or GitHub. So there may even be a lot more than 14,000 packages out there.
The [official R network (CRAN)](https://cran.r-project.org/) features almost 14,000 packages at the time of writing, our `AMR` package being one of them. All these packages were peer-reviewed before publication. Aside from this official channel, there are also developers who choose not to submit to CRAN, but rather keep it on their own public repository, like GitLab or GitHub. So there may even be a lot more than 14,000 packages out there.
Bottom line is, you can really extend it yourself or ask somebody to do this for you. Take for example our `AMR` package. Among other things, it adds reliable reference data to R to help you with the data cleaning and analysis. SPSS, SAS and Stata will never know what a valid MIC value is or what the Gram stain of *E. coli* is. Or that all species of *Klebiella* are resistant to amoxicillin and that Floxapen^&reg;^ is a trade name of flucloxacillin. These facts and properties are often needed to clean existing data, which would be very inconvenient in a software package without reliable reference data. See below for a demonstration.
@ -49,19 +49,19 @@ As said, SPSS is easier to learn than R. But SPSS, SAS and Stata come with major
* **R has a huge community.**
Many R users just ask questions on websites like [StackOverflow.com](https://stackoverflow.com), the largest online community for programmers. At the time of writing, more than [275,000 R-related questions](https://stackoverflow.com/questions/tagged/r?sort=votes) have already been asked on this platform (which covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.
Many R users just ask questions on websites like [StackOverflow.com](https://stackoverflow.com), the largest online community for programmers. At the time of writing, almost [300,000 R-related questions](https://stackoverflow.com/questions/tagged/r?sort=votes) have already been asked on this platform (which covers questions and answers for any programming language). In my own experience, most questions are answered within a couple of minutes.
* **R understands any data type, including SPSS/SAS/Stata.**
And that's not vice versa I'm afraid. You can import data from any source into R. As said, from SPSS/SAS/Stata ([link](https://haven.tidyverse.org/)), but also from Excel ([link](https://readxl.tidyverse.org/)), from flat files like CSV, TXT or TSV ([link](https://readr.tidyverse.org/)), or directly from databases or datawarehouses from anywhere on the world ([link](https://dbplyr.tidyverse.org/)). You can even scrape websites to download tables that are live on the internet ([link](https://github.com/hadley/rvest)).
And that's not vice versa I'm afraid. You can import data from any source into R. From SPSS, SAS and Stata ([link](https://haven.tidyverse.org/)), from Minitab, Epi Info and EpiData ([link](https://cran.r-project.org/package=foreign)), from Excel ([link](https://readxl.tidyverse.org/)), from flat files like CSV, TXT or TSV ([link](https://readr.tidyverse.org/)), or directly from databases and datawarehouses from anywhere on the world ([link](https://dbplyr.tidyverse.org/)). You can even scrape websites to download tables that are live on the internet ([link](https://github.com/hadley/rvest)).
And the best part - you can export from R to all data formats as well. So you can import an SPSS file, do your analysis neatly in R and export back to SPSS. Although you might omit that very last step.
And the best part - you can export from R to most data formats as well. So you can import an SPSS file, do your analysis neatly in R and export the resulting tables to Excel files.
* **R is completely free and open-source.**
No strings attached. It was created and is being maintained by volunteers who believe that (data) science should be open and publicly available to everybody. SPSS, SAS and Stata are quite expensive. IBM SPSS Staticstics only comes with subscriptions nowadays, varying [between USD 1,300 and USD 8,500](https://www.ibm.com/products/spss-statistics/pricing) per computer *per year*. SAS Analytics Pro costs [around USD 10,000](https://www.sas.com/store/products-solutions/sas-analytics-pro/prodPERSANL.html) per computer. Stata also has a business model with subscription fees, varying [between USD 600 and USD 1,200](https://www.stata.com/order/new/bus/single-user-licenses/dl/) per computer per year, but lower prices come with a limitation of the number of variables you can work with.
If you are working at a midsized or small company, you can save it tens of thousands of dollars by using R instead of SPSS - gaining even more functions and flexibility. And all R enthousiasts can do as much PR as they want (like I do here), because nobody is officially associated with or affiliated by R. It is really free.
If you are working at a midsized or small company, you can save it tens of thousands of dollars by using R instead of e.g. SPSS - gaining even more functions and flexibility. And all R enthousiasts can do as much PR as they want (like I do here), because nobody is officially associated with or affiliated by R. It is really free.
If you sometimes write syntaxes in SPSS to run a complete analysis or to 'automate' some of your work, you should perhaps do this in R. You will notice that writing syntaxes in R is a lot more nifty and clever than in SPSS.
@ -92,7 +92,7 @@ atc_tradenames("floxapen")
## Import data from SPSS/SAS/Stata
### RStudio
To work with R, probably the best option is to use [RStudio](https://www.rstudio.com/products/rstudio/). It is an open-source and free desktop environment which not only allows you to run R code, but also supports project management, version management, package management and convenient import menus to work with other data sources. You can also run [RStudio Server](https://www.rstudio.com/products/rstudio/), which is nothing less than the complete RStudio software available as a website (e.g. in your corporate network or at home).
To work with R, probably the best option is to use [RStudio](https://www.rstudio.com/products/rstudio/). It is an open-source and free desktop environment which not only allows you to run R code, but also supports project management, version management, package management and convenient import menus to work with other data sources. You can also install [RStudio Server](https://www.rstudio.com/products/rstudio/) on a private or corporate server, which brings nothing less than the complete RStudio software to you as a website (at home or at work).
To import a data file, just click *Import Dataset* in the Environment tab: