1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 18:46:11 +01:00

add Disqus to website

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-05-17 13:01:17 +02:00
parent acbe2f8558
commit a925a5d2f8
20 changed files with 338 additions and 293 deletions

View File

@ -82,7 +82,6 @@ R-devel:
- echo 'LANGUAGE="en_US.utf8"' > .Renviron
- echo 'LANG="en_US.utf8"' >> .Renviron
- echo 'LANGUAGE="en_US.utf8"' > ~/.Renviron
- rm -rf installed_deps
- Rscriptdevel -e 'sessionInfo()'
# install missing and outdated packages
- Rscriptdevel -e 'source(".gitlab-ci.R"); gl_update_pkg_all(repos = "https://cran.rstudio.com", quiet = TRUE, install_pkgdown = TRUE)'

View File

@ -192,7 +192,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 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/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 16 May 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 17 May 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-05-16</td>
<td align="center">2019-05-17</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-05-16</td>
<td align="center">2019-05-17</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-05-16</td>
<td align="center">2019-05-17</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -327,69 +327,69 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2013-05-13</td>
<td align="center">X4</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">2014-11-13</td>
<td align="center">S2</td>
<td align="center">Hospital B</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">F</td>
</tr>
<tr class="even">
<td align="center">2013-01-01</td>
<td align="center">V1</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">2016-11-12</td>
<td align="center">G5</td>
<td align="center">Hospital A</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">M</td>
</tr>
<tr class="even">
<td align="center">2011-09-23</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</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>
</tr>
<tr class="even">
<td align="center">2016-09-19</td>
<td align="center">G9</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2015-09-22</td>
<td align="center">L6</td>
<td align="center">2010-04-06</td>
<td align="center">C9</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">R</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">2017-09-13</td>
<td align="center">N3</td>
<td align="center">Hospital D</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>
<tr class="odd">
<td align="center">2015-12-01</td>
<td align="center">Z3</td>
<td align="center">Hospital A</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">F</td>
</tr>
<tr class="even">
<td align="center">2011-02-25</td>
<td align="center">F10</td>
<td align="center">2012-04-11</td>
<td align="center">D2</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">R</td>
<td align="center">M</td>
</tr>
</tbody>
@ -411,8 +411,8 @@
#&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,410 52.0% 10,410 52.0%
#&gt; 2 F 9,590 48.0% 20,000 100.0%</code></pre>
#&gt; 1 M 10,325 51.6% 10,325 51.6%
#&gt; 2 F 9,675 48.4% 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>
@ -442,14 +442,14 @@
<a class="sourceLine" id="cb14-18" title="18"><span class="co">#&gt; Pasteurella multocida (no new changes)</span></a>
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Staphylococcus (no new changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; Streptococcus groups A, B, C, G (no new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1532 new changes)</span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; Streptococcus pneumoniae (1508 new changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Viridans group streptococci (no new changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1341 new changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 01: Intrinsic resistance in Enterobacteriaceae (1335 new changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 03: Intrinsic resistance in other Gram-negative bacteria (no new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2834 new changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 04: Intrinsic resistance in Gram-positive bacteria (2792 new changes)</span></a>
<a class="sourceLine" id="cb14-29" title="29"><span class="co">#&gt; Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no new changes)</span></a>
<a class="sourceLine" id="cb14-30" title="30"><span class="co">#&gt; Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no new changes)</span></a>
<a class="sourceLine" id="cb14-31" title="31"><span class="co">#&gt; Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no new changes)</span></a>
@ -457,24 +457,24 @@
<a class="sourceLine" id="cb14-33" title="33"><span class="co">#&gt; Table 13: Interpretive rules for quinolones (no new changes)</span></a>
<a class="sourceLine" id="cb14-34" title="34"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-35" title="35"><span class="co">#&gt; Other rules</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2225 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (109 new changes)</span></a>
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#&gt; Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2206 new changes)</span></a>
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#&gt; Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (141 new changes)</span></a>
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,633 out of 20,000 rows, making a total of 8,041 edits</span></a>
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#&gt; EUCAST rules affected 6,587 out of 20,000 rows, making a total of 7,982 edits</span></a>
<a class="sourceLine" id="cb14-45" title="45"><span class="co">#&gt; =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-46" title="46"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 8,041 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 118 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,906 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,094 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 326 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,577 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 20 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#&gt; =&gt; changed 7,982 test results</span></a>
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#&gt; - 102 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#&gt; - 4,844 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#&gt; - 1,047 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#&gt; - 345 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#&gt; - 1,615 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#&gt; - 29 test results changed from R to I</span></a>
<a class="sourceLine" id="cb14-54" title="54"><span class="co">#&gt; --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-55" title="55"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-56" title="56"><span class="co">#&gt; Use verbose = TRUE to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -502,8 +502,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,706 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 28.5% 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,711 first isolates (28.6% of total)</span></a></code></pre></div>
<p>So only 28.6% 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>
@ -529,19 +529,19 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-31</td>
<td align="center">O3</td>
<td align="center">2010-02-03</td>
<td align="center">Q6</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">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-04-24</td>
<td align="center">O3</td>
<td align="center">2010-03-18</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -551,10 +551,10 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-04-26</td>
<td align="center">O3</td>
<td align="center">2010-04-04</td>
<td align="center">Q6</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">S</td>
@ -562,8 +562,8 @@
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-05-07</td>
<td align="center">O3</td>
<td align="center">2010-04-12</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -573,10 +573,10 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-07-07</td>
<td align="center">O3</td>
<td align="center">2010-05-08</td>
<td align="center">Q6</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">S</td>
@ -584,10 +584,10 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-07-28</td>
<td align="center">O3</td>
<td align="center">2010-08-03</td>
<td align="center">Q6</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>
@ -595,30 +595,30 @@
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-08-30</td>
<td align="center">O3</td>
<td align="center">2010-08-04</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</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">8</td>
<td align="center">2010-09-08</td>
<td align="center">O3</td>
<td align="center">2010-11-02</td>
<td align="center">Q6</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="odd">
<td align="center">9</td>
<td align="center">2010-10-11</td>
<td align="center">O3</td>
<td align="center">2010-11-09</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -628,11 +628,11 @@
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-11-11</td>
<td align="center">O3</td>
<td align="center">2010-12-18</td>
<td align="center">Q6</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">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -650,7 +650,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,027 first weighted isolates (75.1% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,123 first weighted isolates (75.6% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -667,70 +667,70 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-31</td>
<td align="center">O3</td>
<td align="center">2010-02-03</td>
<td align="center">Q6</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">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-04-24</td>
<td align="center">O3</td>
<td align="center">2010-03-18</td>
<td align="center">Q6</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">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-04-26</td>
<td align="center">O3</td>
<td align="center">2010-04-04</td>
<td align="center">Q6</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">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-05-07</td>
<td align="center">O3</td>
<td align="center">2010-04-12</td>
<td align="center">Q6</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">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-07-07</td>
<td align="center">O3</td>
<td align="center">2010-05-08</td>
<td align="center">Q6</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">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-07-28</td>
<td align="center">O3</td>
<td align="center">2010-08-03</td>
<td align="center">Q6</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>
@ -739,11 +739,11 @@
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-08-30</td>
<td align="center">O3</td>
<td align="center">2010-08-04</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -751,20 +751,20 @@
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-09-08</td>
<td align="center">O3</td>
<td align="center">2010-11-02</td>
<td align="center">Q6</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="odd">
<td align="center">9</td>
<td align="center">2010-10-11</td>
<td align="center">O3</td>
<td align="center">2010-11-09</td>
<td align="center">Q6</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -775,11 +775,11 @@
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2010-11-11</td>
<td align="center">O3</td>
<td align="center">2010-12-18</td>
<td align="center">Q6</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">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -787,11 +787,11 @@
</tr>
</tbody>
</table>
<p>Instead of 1, now 10 isolates are flagged. In total, 75.1% of all isolates are marked first weighted - 46.6% 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 1, now 6 isolates are flagged. In total, 75.6% of all isolates are marked first weighted - 47.1% 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,027 isolates for analysis.</p>
<p>So we end up with 15,123 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>
@ -817,78 +817,78 @@
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2013-05-13</td>
<td align="center">X4</td>
<td align="center">Hospital D</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">I</td>
<td align="center">2014-11-13</td>
<td align="center">S2</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">F</td>
<td align="center">Gram positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</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>2</td>
<td align="center">2016-09-19</td>
<td align="center">G9</td>
<td>3</td>
<td align="center">2016-11-12</td>
<td align="center">G5</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</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">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>3</td>
<td align="center">2015-09-22</td>
<td align="center">L6</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COL</td>
<td>4</td>
<td align="center">2011-09-23</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</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">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>5</td>
<td align="center">2015-12-01</td>
<td align="center">Z3</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">2010-04-06</td>
<td align="center">C9</td>
<td align="center">Hospital D</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">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">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="odd">
<td>6</td>
<td align="center">2011-02-25</td>
<td align="center">F10</td>
<td align="center">2012-04-11</td>
<td align="center">D2</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">R</td>
<td align="center">M</td>
<td align="center">Gram positive</td>
<td align="center">Staphylococcus</td>
@ -896,16 +896,16 @@
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>7</td>
<td align="center">2010-08-13</td>
<td align="center">G10</td>
<td>8</td>
<td align="center">2012-08-17</td>
<td align="center">Z4</td>
<td align="center">Hospital C</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">S</td>
<td align="center">M</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
@ -928,9 +928,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,027 x 13)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,123 x 13)</strong></p>
<p>Columns: 2<br>
Length: 15,027 (of which NA: 0 = 0.00%)<br>
Length: 15,123 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -947,33 +947,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,318</td>
<td align="right">48.7%</td>
<td align="right">7,318</td>
<td align="right">48.7%</td>
<td align="right">7,466</td>
<td align="right">49.4%</td>
<td align="right">7,466</td>
<td align="right">49.4%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,729</td>
<td align="right">24.8%</td>
<td align="right">11,047</td>
<td align="right">3,649</td>
<td align="right">24.1%</td>
<td align="right">11,115</td>
<td align="right">73.5%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,370</td>
<td align="right">15.8%</td>
<td align="right">13,417</td>
<td align="right">89.3%</td>
<td align="right">2,381</td>
<td align="right">15.7%</td>
<td align="right">13,496</td>
<td align="right">89.2%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,610</td>
<td align="right">10.7%</td>
<td align="right">15,027</td>
<td align="right">1,627</td>
<td align="right">10.8%</td>
<td align="right">15,123</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -984,7 +984,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>(AMX)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4973714</span></a></code></pre></div>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.5012233</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>
@ -997,19 +997,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4993375</td>
<td align="center">0.5100641</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4931245</td>
<td align="center">0.4945632</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5068182</td>
<td align="center">0.4960457</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4949396</td>
<td align="center">0.5036765</td>
</tr>
</tbody>
</table>
@ -1027,23 +1027,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4993375</td>
<td align="center">4528</td>
<td align="center">0.5100641</td>
<td align="center">4521</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4931245</td>
<td align="center">5236</td>
<td align="center">0.4945632</td>
<td align="center">5334</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5068182</td>
<td align="center">2200</td>
<td align="center">0.4960457</td>
<td align="center">2276</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4949396</td>
<td align="center">3063</td>
<td align="center">0.5036765</td>
<td align="center">2992</td>
</tr>
</tbody>
</table>
@ -1063,27 +1063,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.8800219</td>
<td align="center">0.8938234</td>
<td align="center">0.9885215</td>
<td align="center">0.8775784</td>
<td align="center">0.8984731</td>
<td align="center">0.9910260</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.7136646</td>
<td align="center">0.9012422</td>
<td align="center">0.9732919</td>
<td align="center">0.7221881</td>
<td align="center">0.9053473</td>
<td align="center">0.9778734</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.8806651</td>
<td align="center">0.9115044</td>
<td align="center">0.9895414</td>
<td align="center">0.8766785</td>
<td align="center">0.9188819</td>
<td align="center">0.9887640</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5751055</td>
<td align="center">0.5732885</td>
<td align="center">0.0000000</td>
<td align="center">0.5751055</td>
<td align="center">0.5732885</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: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -192,7 +192,7 @@
<h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to use the <em>G</em>-test</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>G_test.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>SPSS.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to get properties of an antibiotic</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>ab_property.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -217,14 +217,14 @@
<a class="sourceLine" id="cb2-8" title="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<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") 17.0 18 26 18.0 18.0 65 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 47.0 47 52 48.0 49.0 92 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 17.0 18 22 18.0 18.0 62 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 18.0 18 24 18.0 18.0 78 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 37 28.0 30.0 73 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 46 28.0 72.0 120 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 7.9 8 13 8.3 8.5 52 10</span></a></code></pre></div>
<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") 17.0 18 27 18 18 65.0 10</span></a>
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#&gt; as.mo("stau") 47.0 48 57 48 48 92.0 10</span></a>
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#&gt; as.mo("staaur") 17.0 18 24 18 18 81.0 10</span></a>
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#&gt; as.mo("STAAUR") 18.0 18 31 18 62 62.0 10</span></a>
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 28 28 29 29.0 10</span></a>
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#&gt; as.mo("S. aureus") 28.0 28 42 28 31 110.0 10</span></a>
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#&gt; as.mo("Staphylococcus aureus") 7.9 8 8 8 8 8.6 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 520 530 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 470 470 490 480 520 530 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 76 76 91 77 120 120 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 76 76 90 76 120 120 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 74 74 95 81 120 130 10</span></a></code></pre></div>
<p>That takes 8 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") 470 470 500 500 520 520 10</span></a>
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#&gt; as.mo("THEISL") 470 470 500 470 520 580 10</span></a>
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#&gt; as.mo("T. islandicus") 76 76 86 76 77 130 10</span></a>
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#&gt; as.mo("T. islandicus") 75 76 82 76 78 120 10</span></a>
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#&gt; as.mo("Thermus islandicus") 74 74 110 120 120 150 10</span></a></code></pre></div>
<p>That takes 8.2 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>
@ -286,9 +286,9 @@
<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) 732 811 816 817 819 941 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.82 seconds (817 ms). You only lose time on your unique input values.</p>
<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) 823 826 864 833 869 1080 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.83 seconds (832 ms). You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
@ -300,11 +300,11 @@
<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.80 12.90 13.30 13.30 13.60 14.20 10</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#&gt; B 25.40 25.60 30.70 25.90 27.40 70.80 10</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#&gt; C 1.25 1.36 1.54 1.68 1.69 1.74 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.0017 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>
<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.90 13.30 13.7 13.70 14.10 14.5 10</span></a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#&gt; B 25.10 25.70 26.2 25.90 26.60 27.8 10</span></a>
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#&gt; C 1.46 1.68 6.2 1.84 1.89 46.1 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.0018 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>
<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>
@ -317,14 +317,14 @@
<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.403 0.504 0.523 0.531 0.563 0.627 10</span></a>
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#&gt; B 0.431 0.542 0.620 0.640 0.685 0.785 10</span></a>
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#&gt; C 1.310 1.450 1.640 1.650 1.880 1.980 10</span></a>
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#&gt; D 0.427 0.468 0.599 0.566 0.597 0.943 10</span></a>
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#&gt; E 0.406 0.510 0.542 0.526 0.593 0.715 10</span></a>
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#&gt; F 0.358 0.422 0.492 0.481 0.511 0.678 10</span></a>
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#&gt; G 0.349 0.425 0.487 0.485 0.512 0.661 10</span></a>
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#&gt; H 0.204 0.292 0.360 0.341 0.434 0.528 10</span></a></code></pre></div>
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#&gt; A 0.354 0.404 0.470 0.486 0.527 0.534 10</span></a>
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#&gt; B 0.413 0.529 0.581 0.538 0.642 0.917 10</span></a>
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#&gt; C 1.510 1.720 1.780 1.810 1.870 1.900 10</span></a>
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#&gt; D 0.443 0.522 0.547 0.538 0.595 0.664 10</span></a>
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#&gt; E 0.371 0.431 0.474 0.467 0.515 0.588 10</span></a>
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#&gt; F 0.372 0.427 0.453 0.453 0.494 0.519 10</span></a>
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#&gt; G 0.400 0.430 0.456 0.446 0.488 0.522 10</span></a>
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#&gt; H 0.194 0.276 0.301 0.301 0.332 0.395 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">
@ -351,13 +351,13 @@
<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 18.16 18.21 18.27 18.23 18.25 18.53 10</span></a>
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#&gt; de 23.02 23.12 23.25 23.19 23.40 23.62 10</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#&gt; nl 35.25 35.46 40.22 35.93 36.49 79.63 10</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#&gt; es 22.97 23.07 27.79 23.34 23.69 68.06 10</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#&gt; it 22.91 22.91 32.09 23.21 23.96 67.71 10</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#&gt; fr 23.10 23.13 27.95 23.46 23.65 67.64 10</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#&gt; pt 22.96 23.07 23.22 23.14 23.42 23.63 10</span></a></code></pre></div>
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#&gt; en 18.18 18.30 18.50 18.46 18.63 18.88 10</span></a>
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#&gt; de 23.02 23.10 23.38 23.27 23.57 24.23 10</span></a>
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#&gt; nl 36.73 36.79 37.05 36.95 37.26 37.74 10</span></a>
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#&gt; es 22.97 23.14 23.35 23.22 23.68 23.79 10</span></a>
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#&gt; it 22.99 23.05 23.17 23.13 23.22 23.55 10</span></a>
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#&gt; fr 23.12 23.14 32.29 23.25 23.90 68.31 10</span></a>
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#&gt; pt 23.10 23.12 32.39 23.56 23.79 68.65 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: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -192,7 +192,7 @@
<h1>How to create frequency tables</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>freq.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to get properties of a microorganism</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>mo_property.Rmd</code></div>

View File

@ -192,7 +192,7 @@
<h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">16 May 2019</h4>
<h4 class="date">17 May 2019</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div>

View File

@ -203,3 +203,9 @@ table a:not(.btn):hover, .table a:not(.btn):hover {
color: black;
font-weight: bold;
}
#collapseDisqus {
padding: 2%;
border: 2px #2c3e50 dashed;
margin-top: 1%;
}

View File

@ -23,6 +23,8 @@
// Add updated Font Awesome 5.6.3 library
$('head').append('<!-- Updated Font Awesome library --><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">');
// Add Disqus
$('head').append('<script src="https://amr-for-r.disqus.com/embed.js" data-timestamp="' + new Date() + '"></script');
// Email template for new GitLab issues
//https://stackoverflow.com/a/33190494/4575331
@ -38,27 +40,40 @@ $( document ).ready(function() {
window.location.replace(url_new);
}
// PR for 'R for Data Science' on How To pages
if ($(".template-article").length > 0) {
$('#sidebar').prepend(
'<div id="r4ds">' +
' <a target="_blank" href="https://r4ds.had.co.nz/">' +
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
// PR for 'R for Data Science' on How To pages
$('#sidebar').prepend(
'<div id="r4ds">' +
' <a target="_blank" href="https://r4ds.had.co.nz/">' +
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
}
// Add Disqus to all pages
var disqus =
'<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseDisqus" aria-expanded="false" aria-controls="collapseDisqus">' +
' Having a question? Or knowing something we don\'t? Click here to open comments.' +
'</button>' +
'<div class="collapse" id="collapseDisqus">' +
'<div id="disqus_thread"></div>' +
'</div>';
$(disqus).insertBefore('footer');
$('#disqus_thread footer').remove();
$('footer').html(
'<div>' +
'<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="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'<code>AMR</code> (for R). Developed at the <a href="https://www.rug.nl">University of Groningen</a>.<br>Authors:') + '</p>' +
'<a href="https://www.rug.nl"><img src="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'</div>');
$('footer').html($('footer').html().replace(/href/g, 'target="_blank" href'));
// doctoral titles of authors
function doct_tit(x) {
@ -67,8 +82,10 @@ $( document ).ready(function() {
x = x.replace("Alex", "Prof Dr Alex");
x = x.replace("Bhanu", "Prof Dr Bhanu");
x = x.replace(/Author, thesis advisor/g, "Doctoral advisor");
x = x.replace(/Authors/g, "aut_plural");
x = x.replace(/Author, maintainer./g, "");
x = x.replace(/Author./g, "");
x = x.replace(/Author/g, "");
x = x.replace(/aut_plural/g, "Authors");
}
return(x);
}

View File

@ -203,3 +203,9 @@ table a:not(.btn):hover, .table a:not(.btn):hover {
color: black;
font-weight: bold;
}
#collapseDisqus {
padding: 2%;
border: 2px #2c3e50 dashed;
margin-top: 1%;
}

View File

@ -23,6 +23,8 @@
// Add updated Font Awesome 5.6.3 library
$('head').append('<!-- Updated Font Awesome library --><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">');
// Add Disqus
$('head').append('<script src="https://amr-for-r.disqus.com/embed.js" data-timestamp="' + new Date() + '"></script');
// Email template for new GitLab issues
//https://stackoverflow.com/a/33190494/4575331
@ -38,27 +40,40 @@ $( document ).ready(function() {
window.location.replace(url_new);
}
// PR for 'R for Data Science' on How To pages
if ($(".template-article").length > 0) {
$('#sidebar').prepend(
'<div id="r4ds">' +
' <a target="_blank" href="https://r4ds.had.co.nz/">' +
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
// PR for 'R for Data Science' on How To pages
$('#sidebar').prepend(
'<div id="r4ds">' +
' <a target="_blank" href="https://r4ds.had.co.nz/">' +
' Learn R reading this great book: R for Data Science.' +
' <br><br>' +
' Click to read it online - it was published for free.' +
' <img src="https://gitlab.com/msberends/AMR/raw/master/docs/cover_r4ds.png" height="100px">' +
' </a> ' +
' <hr>' +
'</div>');
}
// Add Disqus to all pages
var disqus =
'<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseDisqus" aria-expanded="false" aria-controls="collapseDisqus">' +
' Having a question? Or knowing something we don\'t? Click here to open comments.' +
'</button>' +
'<div class="collapse" id="collapseDisqus">' +
'<div id="disqus_thread"></div>' +
'</div>';
$(disqus).insertBefore('footer');
$('#disqus_thread footer').remove();
$('footer').html(
'<div>' +
'<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="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'<code>AMR</code> (for R). Developed at the <a href="https://www.rug.nl">University of Groningen</a>.<br>Authors:') + '</p>' +
'<a href="https://www.rug.nl"><img src="https://gitlab.com/msberends/AMR/raw/master/docs/logo_rug.png" class="footer_logo"></a>' +
'</div>');
$('footer').html($('footer').html().replace(/href/g, 'target="_blank" href'));
// doctoral titles of authors
function doct_tit(x) {
@ -67,8 +82,10 @@ $( document ).ready(function() {
x = x.replace("Alex", "Prof Dr Alex");
x = x.replace("Bhanu", "Prof Dr Bhanu");
x = x.replace(/Author, thesis advisor/g, "Doctoral advisor");
x = x.replace(/Authors/g, "aut_plural");
x = x.replace(/Author, maintainer./g, "");
x = x.replace(/Author./g, "");
x = x.replace(/Author/g, "");
x = x.replace(/aut_plural/g, "Authors");
}
return(x);
}