website update
@ -192,7 +192,7 @@
|
||||
<h1>How to conduct AMR analysis</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
<h4 class="date">12 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 10 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 12 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-10</td>
|
||||
<td align="center">2019-05-12</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-10</td>
|
||||
<td align="center">2019-05-12</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-10</td>
|
||||
<td align="center">2019-05-12</td>
|
||||
<td align="center">efgh</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
@ -327,9 +327,31 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">2017-12-11</td>
|
||||
<td align="center">C4</td>
|
||||
<td align="center">2016-07-20</td>
|
||||
<td align="center">N4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Klebsiella pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2013-12-24</td>
|
||||
<td align="center">L1</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>
|
||||
<tr class="odd">
|
||||
<td align="center">2010-04-21</td>
|
||||
<td align="center">C10</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">Escherichia coli</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
@ -338,20 +360,9 @@
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2010-12-13</td>
|
||||
<td align="center">K6</td>
|
||||
<td align="center">2015-07-23</td>
|
||||
<td align="center">A3</td>
|
||||
<td align="center">Hospital B</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">M</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2014-03-15</td>
|
||||
<td align="center">J1</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -359,39 +370,28 @@
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2011-10-17</td>
|
||||
<td align="center">V7</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">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2010-09-09</td>
|
||||
<td align="center">T6</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">2014-09-20</td>
|
||||
<td align="center">X4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">Staphylococcus aureus</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">F</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">2011-07-28</td>
|
||||
<td align="center">P4</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="even">
|
||||
<td align="center">2010-01-15</td>
|
||||
<td align="center">M8</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">Streptococcus pneumoniae</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">M</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Now, let’s start the cleaning and the analysis!</p>
|
||||
@ -411,8 +411,8 @@
|
||||
#>
|
||||
#> Item Count Percent Cum. Count Cum. Percent
|
||||
#> --- ----- ------- -------- ----------- -------------
|
||||
#> 1 M 10,314 51.6% 10,314 51.6%
|
||||
#> 2 F 9,686 48.4% 20,000 100.0%</code></pre>
|
||||
#> 1 M 10,367 51.8% 10,367 51.8%
|
||||
#> 2 F 9,633 48.2% 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 didn’t 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 <-<span class="st"> </span>data <span class="op">%>%</span></a>
|
||||
@ -442,14 +442,14 @@
|
||||
<a class="sourceLine" id="cb14-18" title="18"><span class="co">#> Pasteurella multocida (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#> Staphylococcus (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#> Streptococcus groups A, B, C, G (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#> Streptococcus pneumoniae (1422 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#> Streptococcus pneumoniae (1473 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#> Viridans group streptococci (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#> </span></a>
|
||||
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#> EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#> Table 01: Intrinsic resistance in Enterobacteriaceae (1271 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#> Table 01: Intrinsic resistance in Enterobacteriaceae (1282 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#> 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">#> 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">#> Table 04: Intrinsic resistance in Gram-positive bacteria (2747 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#> Table 04: Intrinsic resistance in Gram-positive bacteria (2691 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-29" title="29"><span class="co">#> 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">#> 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">#> 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">#> Table 13: Interpretive rules for quinolones (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-34" title="34"><span class="co">#> </span></a>
|
||||
<a class="sourceLine" id="cb14-35" title="35"><span class="co">#> Other rules</span></a>
|
||||
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#> Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2255 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#> Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (112 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-36" title="36"><span class="co">#> Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2218 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-37" title="37"><span class="co">#> Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (124 new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#> Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#> Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#> Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#> Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no new changes)</span></a>
|
||||
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#> </span></a>
|
||||
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#> --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#> EUCAST rules affected 6,518 out of 20,000 rows, making a total of 7,807 edits</span></a>
|
||||
<a class="sourceLine" id="cb14-44" title="44"><span class="co">#> EUCAST rules affected 6,442 out of 20,000 rows, making a total of 7,788 edits</span></a>
|
||||
<a class="sourceLine" id="cb14-45" title="45"><span class="co">#> => added 0 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-46" title="46"><span class="co">#> </span></a>
|
||||
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#> => changed 7,807 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#> - 104 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#> - 4,681 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#> - 1,080 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#> - 336 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#> - 1,588 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#> - 18 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb14-47" title="47"><span class="co">#> => changed 7,788 test results</span></a>
|
||||
<a class="sourceLine" id="cb14-48" title="48"><span class="co">#> - 105 test results changed from S to I</span></a>
|
||||
<a class="sourceLine" id="cb14-49" title="49"><span class="co">#> - 4,678 test results changed from S to R</span></a>
|
||||
<a class="sourceLine" id="cb14-50" title="50"><span class="co">#> - 1,081 test results changed from I to S</span></a>
|
||||
<a class="sourceLine" id="cb14-51" title="51"><span class="co">#> - 315 test results changed from I to R</span></a>
|
||||
<a class="sourceLine" id="cb14-52" title="52"><span class="co">#> - 1,587 test results changed from R to S</span></a>
|
||||
<a class="sourceLine" id="cb14-53" title="53"><span class="co">#> - 22 test results changed from R to I</span></a>
|
||||
<a class="sourceLine" id="cb14-54" title="54"><span class="co">#> --------------------------------------------------------------------------</span></a>
|
||||
<a class="sourceLine" id="cb14-55" title="55"><span class="co">#> </span></a>
|
||||
<a class="sourceLine" id="cb14-56" title="56"><span class="co">#> 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">#> </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">#> </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">#> </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">#> => Found 5,643 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">#> => Found 5,682 first isolates (28.4% of total)</span></a></code></pre></div>
|
||||
<p>So only 28.4% 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 <-<span class="st"> </span>data <span class="op">%>%</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,74 +529,74 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-22</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-01-10</td>
|
||||
<td align="center">H7</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">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-03-11</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-01-23</td>
|
||||
<td align="center">H7</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">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-03-17</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-05-15</td>
|
||||
<td align="center">H7</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">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-04-28</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-08-16</td>
|
||||
<td align="center">H7</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">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-05-26</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-09-26</td>
|
||||
<td align="center">H7</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="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-06-03</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-11-01</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</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">7</td>
|
||||
<td align="center">2010-07-03</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-12-11</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -606,32 +606,32 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2010-07-07</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-02-11</td>
|
||||
<td align="center">H7</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">FALSE</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2010-07-30</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-03-16</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">I</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>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2010-10-12</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-04-14</td>
|
||||
<td align="center">H7</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>
|
||||
@ -639,7 +639,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
|
||||
<p>Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
|
||||
<p>If a column exists with a name like ‘key(…)ab’ the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1">data <-<span class="st"> </span>data <span class="op">%>%</span><span class="st"> </span></a>
|
||||
<a class="sourceLine" id="cb19-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%>%</span><span class="st"> </span></a>
|
||||
@ -650,7 +650,7 @@
|
||||
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#> </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">#> </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">#> [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
|
||||
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#> => Found 15,129 first weighted isolates (75.6% of total)</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#> => Found 15,036 first weighted isolates (75.2% of total)</span></a></code></pre></div>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="center">isolate</th>
|
||||
@ -667,71 +667,71 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">1</td>
|
||||
<td align="center">2010-01-22</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-01-10</td>
|
||||
<td align="center">H7</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">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">2</td>
|
||||
<td align="center">2010-03-11</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-01-23</td>
|
||||
<td align="center">H7</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">FALSE</td>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-03-17</td>
|
||||
<td align="center">M1</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">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-04-28</td>
|
||||
<td align="center">M1</td>
|
||||
<tr class="odd">
|
||||
<td align="center">3</td>
|
||||
<td align="center">2010-05-15</td>
|
||||
<td align="center">H7</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">R</td>
|
||||
<td align="center">FALSE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">4</td>
|
||||
<td align="center">2010-08-16</td>
|
||||
<td align="center">H7</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>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">5</td>
|
||||
<td align="center">2010-05-26</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-09-26</td>
|
||||
<td align="center">H7</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="even">
|
||||
<td align="center">6</td>
|
||||
<td align="center">2010-06-03</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-11-01</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">FALSE</td>
|
||||
@ -739,8 +739,8 @@
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">7</td>
|
||||
<td align="center">2010-07-03</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2010-12-11</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -751,34 +751,34 @@
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">8</td>
|
||||
<td align="center">2010-07-07</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-02-11</td>
|
||||
<td align="center">H7</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">FALSE</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">TRUE</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">9</td>
|
||||
<td align="center">2010-07-30</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-03-16</td>
|
||||
<td align="center">H7</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">I</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>
|
||||
<td align="center">FALSE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">10</td>
|
||||
<td align="center">2010-10-12</td>
|
||||
<td align="center">M1</td>
|
||||
<td align="center">2011-04-14</td>
|
||||
<td align="center">H7</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>
|
||||
@ -787,11 +787,11 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Instead of 1, now 9 isolates are flagged. In total, 75.6% of all isolates are marked ‘first weighted’ - 47.4% 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 9 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.8% 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>, there’s 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 <-<span class="st"> </span>data <span class="op">%>%</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,129 isolates for analysis.</p>
|
||||
<p>So we end up with 15,036 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 <-<span class="st"> </span>data_1st <span class="op">%>%</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,9 +817,25 @@
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>1</td>
|
||||
<td align="center">2017-12-11</td>
|
||||
<td align="center">C4</td>
|
||||
<td align="center">2016-07-20</td>
|
||||
<td align="center">N4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_KLBSL_PNE</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">Klebsiella</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>3</td>
|
||||
<td align="center">2010-04-21</td>
|
||||
<td align="center">C10</td>
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">B_ESCHR_COL</td>
|
||||
<td align="center">R</td>
|
||||
<td align="center">I</td>
|
||||
@ -831,11 +847,11 @@
|
||||
<td align="center">coli</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>3</td>
|
||||
<td align="center">2014-03-15</td>
|
||||
<td align="center">J1</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<tr class="odd">
|
||||
<td>4</td>
|
||||
<td align="center">2015-07-23</td>
|
||||
<td align="center">A3</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STRPT_PNE</td>
|
||||
<td align="center">S</td>
|
||||
<td align="center">S</td>
|
||||
@ -847,16 +863,32 @@
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>5</td>
|
||||
<td align="center">2011-10-17</td>
|
||||
<td align="center">V7</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">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="odd">
|
||||
<td>4</td>
|
||||
<td align="center">2010-09-09</td>
|
||||
<td align="center">T6</td>
|
||||
<td align="center">Hospital C</td>
|
||||
<td>6</td>
|
||||
<td align="center">2014-09-20</td>
|
||||
<td align="center">X4</td>
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">B_STPHY_AUR</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">F</td>
|
||||
<td align="center">Gram positive</td>
|
||||
<td align="center">Staphylococcus</td>
|
||||
@ -864,46 +896,14 @@
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>6</td>
|
||||
<td align="center">2010-01-15</td>
|
||||
<td align="center">M8</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">B_STRPT_PNE</td>
|
||||
<td align="center">I</td>
|
||||
<td align="center">I</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">Streptococcus</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>7</td>
|
||||
<td align="center">2015-04-19</td>
|
||||
<td align="center">E5</td>
|
||||
<td align="center">Hospital C</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">Klebsiella</td>
|
||||
<td align="center">pneumoniae</td>
|
||||
<td align="center">TRUE</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>8</td>
|
||||
<td align="center">2016-03-04</td>
|
||||
<td align="center">R4</td>
|
||||
<td align="center">Hospital A</td>
|
||||
<td align="center">2015-09-29</td>
|
||||
<td align="center">S7</td>
|
||||
<td align="center">Hospital D</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">F</td>
|
||||
<td align="center">Gram negative</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">%>%</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,129 x 13)</strong></p>
|
||||
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,036 x 13)</strong></p>
|
||||
<p>Columns: 2<br>
|
||||
Length: 15,129 (of which NA: 0 = 0.00%)<br>
|
||||
Length: 15,036 (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,579</td>
|
||||
<td align="right">50.1%</td>
|
||||
<td align="right">7,579</td>
|
||||
<td align="right">50.1%</td>
|
||||
<td align="right">7,441</td>
|
||||
<td align="right">49.5%</td>
|
||||
<td align="right">7,441</td>
|
||||
<td align="right">49.5%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
<td align="left">Staphylococcus aureus</td>
|
||||
<td align="right">3,675</td>
|
||||
<td align="right">24.3%</td>
|
||||
<td align="right">11,254</td>
|
||||
<td align="right">74.4%</td>
|
||||
<td align="right">3,779</td>
|
||||
<td align="right">25.1%</td>
|
||||
<td align="right">11,220</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,319</td>
|
||||
<td align="right">15.3%</td>
|
||||
<td align="right">13,573</td>
|
||||
<td align="right">89.7%</td>
|
||||
<td align="right">2,278</td>
|
||||
<td align="right">15.2%</td>
|
||||
<td align="right">13,498</td>
|
||||
<td align="right">89.8%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
<td align="left">Klebsiella pneumoniae</td>
|
||||
<td align="right">1,556</td>
|
||||
<td align="right">10.3%</td>
|
||||
<td align="right">15,129</td>
|
||||
<td align="right">1,538</td>
|
||||
<td align="right">10.2%</td>
|
||||
<td align="right">15,036</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">%>%</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">#> [1] 0.4931588</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#> [1] 0.494879</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">%>%</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">%>%</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.4884229</td>
|
||||
<td align="center">0.5024412</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4994329</td>
|
||||
<td align="center">0.5015980</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4838561</td>
|
||||
<td align="center">0.4683146</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4959586</td>
|
||||
<td align="center">0.4912927</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.4884229</td>
|
||||
<td align="center">4578</td>
|
||||
<td align="center">0.5024412</td>
|
||||
<td align="center">4506</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital B</td>
|
||||
<td align="center">0.4994329</td>
|
||||
<td align="center">5290</td>
|
||||
<td align="center">0.5015980</td>
|
||||
<td align="center">5319</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Hospital C</td>
|
||||
<td align="center">0.4838561</td>
|
||||
<td align="center">2168</td>
|
||||
<td align="center">0.4683146</td>
|
||||
<td align="center">2225</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Hospital D</td>
|
||||
<td align="center">0.4959586</td>
|
||||
<td align="center">3093</td>
|
||||
<td align="center">0.4912927</td>
|
||||
<td align="center">2986</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1063,27 +1063,27 @@ Longest: 24</p>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td align="center">Escherichia</td>
|
||||
<td align="center">0.8857369</td>
|
||||
<td align="center">0.8953688</td>
|
||||
<td align="center">0.9886529</td>
|
||||
<td align="center">0.8770327</td>
|
||||
<td align="center">0.8982664</td>
|
||||
<td align="center">0.9908614</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Klebsiella</td>
|
||||
<td align="center">0.7345758</td>
|
||||
<td align="center">0.8901028</td>
|
||||
<td align="center">0.9678663</td>
|
||||
<td align="center">0.7418726</td>
|
||||
<td align="center">0.9037711</td>
|
||||
<td align="center">0.9817945</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="center">Staphylococcus</td>
|
||||
<td align="center">0.8775510</td>
|
||||
<td align="center">0.9235374</td>
|
||||
<td align="center">0.9874830</td>
|
||||
<td align="center">0.8840963</td>
|
||||
<td align="center">0.9237894</td>
|
||||
<td align="center">0.9886213</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="center">Streptococcus</td>
|
||||
<td align="center">0.5804226</td>
|
||||
<td align="center">0.5697981</td>
|
||||
<td align="center">0.0000000</td>
|
||||
<td align="center">0.5804226</td>
|
||||
<td align="center">0.5697981</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
@ -192,7 +192,7 @@
|
||||
<h1>How to import data from SPSS / SAS / Stata</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
<h4 class="date">12 May 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>SPSS.Rmd</code></div>
|
||||
|
@ -192,7 +192,7 @@
|
||||
<h1>How to get properties of an antibiotic</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
<h4 class="date">12 May 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>ab_property.Rmd</code></div>
|
||||
|
@ -192,7 +192,7 @@
|
||||
<h1>Benchmarks</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
<h4 class="date">12 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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 18.0 18 23.0 18 18.0 65 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 47.0 48 48.0 48 48.0 50 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 18.0 18 22.0 18 18.0 62 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 18.0 18 32.0 19 62.0 62 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 28.0 28 42.0 28 28.0 120 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28.0 28 40.0 28 29.0 98 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 7.9 8 9.2 8 8.1 20 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb2-11" title="11"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb2-12" title="12"><span class="co">#> as.mo("sau") 17.0 17.0 22.0 18 18 65 10</span></a>
|
||||
<a class="sourceLine" id="cb2-13" title="13"><span class="co">#> as.mo("stau") 47.0 47.0 52.0 47 48 92 10</span></a>
|
||||
<a class="sourceLine" id="cb2-14" title="14"><span class="co">#> as.mo("staaur") 17.0 18.0 18.0 18 18 18 10</span></a>
|
||||
<a class="sourceLine" id="cb2-15" title="15"><span class="co">#> as.mo("STAAUR") 17.0 18.0 32.0 18 62 77 10</span></a>
|
||||
<a class="sourceLine" id="cb2-16" title="16"><span class="co">#> as.mo("S. aureus") 28.0 28.0 37.0 28 30 72 10</span></a>
|
||||
<a class="sourceLine" id="cb2-17" title="17"><span class="co">#> as.mo("S. aureus") 28.0 28.0 46.0 29 72 110 10</span></a>
|
||||
<a class="sourceLine" id="cb2-18" title="18"><span class="co">#> as.mo("Staphylococcus aureus") 7.9 7.9 8.4 8 8 12 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 <-<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,11 +236,11 @@
|
||||
<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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb3-9" title="9"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 470 470 490 470 520 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 470 470 500 510 520 520 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 76 76 81 76 77 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 76 76 94 78 120 120 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 74 74 96 77 120 150 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb3-10" title="10"><span class="co">#> as.mo("theisl") 470 470 490 480 520 530 10</span></a>
|
||||
<a class="sourceLine" id="cb3-11" title="11"><span class="co">#> as.mo("THEISL") 470 520 520 520 520 530 10</span></a>
|
||||
<a class="sourceLine" id="cb3-12" title="12"><span class="co">#> as.mo("T. islandicus") 75 76 76 76 76 77 10</span></a>
|
||||
<a class="sourceLine" id="cb3-13" title="13"><span class="co">#> as.mo("T. islandicus") 76 76 86 77 79 130 10</span></a>
|
||||
<a class="sourceLine" id="cb3-14" title="14"><span class="co">#> as.mo("Thermus islandicus") 74 74 89 75 120 120 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>
|
||||
@ -287,8 +287,8 @@
|
||||
<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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb5-26" title="26"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 777 780 859 864 870 1080 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.86 seconds (864 ms). You only lose time on your unique input values.</p>
|
||||
<a class="sourceLine" id="cb5-27" title="27"><span class="co">#> mo_fullname(x) 836 837 893 883 925 1000 10</span></a></code></pre></div>
|
||||
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.88 seconds (882 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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb6-7" title="7"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 13.30 14.0 14.3 14.1 14.30 17.30 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.20 25.5 36.5 26.5 39.60 71.30 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 1.68 1.7 1.9 1.8 1.94 2.81 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 doesn’t 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">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"><span class="co">#> A 12.80 13.10 13.20 13.20 13.20 13.50 10</span></a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"><span class="co">#> B 25.20 25.30 30.00 25.60 25.90 69.70 10</span></a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"><span class="co">#> C 1.26 1.37 1.58 1.69 1.72 1.73 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 doesn’t 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 <-<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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb7-12" title="12"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.417 0.456 0.511 0.494 0.558 0.612 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.416 0.555 0.620 0.614 0.658 0.837 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 1.360 1.630 1.970 1.880 1.970 3.220 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.435 0.519 0.671 0.665 0.734 1.120 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.356 0.429 0.491 0.452 0.486 0.916 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.384 0.450 0.559 0.502 0.543 1.180 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.407 0.450 0.591 0.527 0.663 1.080 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.219 0.272 0.295 0.276 0.311 0.420 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb7-13" title="13"><span class="co">#> A 0.429 0.441 0.486 0.491 0.510 0.562 10</span></a>
|
||||
<a class="sourceLine" id="cb7-14" title="14"><span class="co">#> B 0.437 0.521 0.555 0.577 0.596 0.651 10</span></a>
|
||||
<a class="sourceLine" id="cb7-15" title="15"><span class="co">#> C 1.300 1.460 1.730 1.890 1.900 1.960 10</span></a>
|
||||
<a class="sourceLine" id="cb7-16" title="16"><span class="co">#> D 0.444 0.531 0.565 0.563 0.619 0.704 10</span></a>
|
||||
<a class="sourceLine" id="cb7-17" title="17"><span class="co">#> E 0.399 0.431 0.471 0.471 0.508 0.535 10</span></a>
|
||||
<a class="sourceLine" id="cb7-18" title="18"><span class="co">#> F 0.344 0.396 0.432 0.445 0.471 0.500 10</span></a>
|
||||
<a class="sourceLine" id="cb7-19" title="19"><span class="co">#> G 0.390 0.397 0.464 0.465 0.492 0.624 10</span></a>
|
||||
<a class="sourceLine" id="cb7-20" title="20"><span class="co">#> H 0.201 0.222 0.291 0.303 0.339 0.423 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">
|
||||
@ -350,14 +350,14 @@
|
||||
<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">#> Unit: milliseconds</span></a>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.34 18.37 23.22 18.54 19.53 63.17 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 23.46 23.50 23.76 23.57 23.76 25.10 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 50.78 52.48 62.59 53.54 57.07 100.20 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 23.53 23.59 28.70 23.76 24.17 68.55 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 23.31 23.40 23.69 23.51 23.79 24.73 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 23.45 23.52 24.21 24.06 24.88 25.21 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 23.54 23.72 24.37 24.39 24.90 25.58 10</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb8-20" title="20"><span class="co">#> expr min lq mean median uq max neval</span></a>
|
||||
<a class="sourceLine" id="cb8-21" title="21"><span class="co">#> en 18.01 18.11 18.30 18.27 18.35 18.78 10</span></a>
|
||||
<a class="sourceLine" id="cb8-22" title="22"><span class="co">#> de 22.91 23.00 27.53 23.03 23.28 67.49 10</span></a>
|
||||
<a class="sourceLine" id="cb8-23" title="23"><span class="co">#> nl 35.30 35.42 44.34 35.49 35.90 79.60 10</span></a>
|
||||
<a class="sourceLine" id="cb8-24" title="24"><span class="co">#> es 22.98 23.02 23.18 23.09 23.31 23.58 10</span></a>
|
||||
<a class="sourceLine" id="cb8-25" title="25"><span class="co">#> it 22.82 22.89 23.02 22.95 23.19 23.29 10</span></a>
|
||||
<a class="sourceLine" id="cb8-26" title="26"><span class="co">#> fr 22.95 23.05 23.08 23.08 23.10 23.36 10</span></a>
|
||||
<a class="sourceLine" id="cb8-27" title="27"><span class="co">#> pt 22.99 23.06 32.00 23.16 23.32 67.65 10</span></a></code></pre></div>
|
||||
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -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.6.0</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9003</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="../reference/atc_property.html">
|
||||
<a href="../reference/ab_property.html">
|
||||
<span class="fa fa-capsules"></span>
|
||||
|
||||
Get properties of an antibiotic
|
||||
@ -192,7 +192,7 @@
|
||||
<h1>How to create frequency tables</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">27 March 2019</h4>
|
||||
<h4 class="date">12 May 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>freq.Rmd</code></div>
|
||||
@ -239,7 +239,7 @@ Longest: 1</p>
|
||||
<td align="left">2</td>
|
||||
<td align="left">F</td>
|
||||
<td align="right">969</td>
|
||||
<td align="right">48.5%</td>
|
||||
<td align="right">48.4%</td>
|
||||
<td align="right">2,000</td>
|
||||
<td align="right">100.0%</td>
|
||||
</tr>
|
||||
@ -258,17 +258,16 @@ 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" "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>
|
||||
<a class="sourceLine" id="cb3-4" title="4"><span class="co"># [11] "subspecies" "rank" "ref" "species_id" "source"</span></a></code></pre></div>
|
||||
<p>If we compare the dimensions between the old and new dataset, we can see that these 14 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 64</span></a></code></pre></div>
|
||||
<a class="sourceLine" id="cb4-4" title="4"><span class="co"># [1] 2000 63</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">%>%</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 64)</strong></p>
|
||||
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (2,000 x 63)</strong></p>
|
||||
<p>Columns: 2<br>
|
||||
Length: 2,000 (of which NA: 0 = 0.00%)<br>
|
||||
Unique: 95</p>
|
||||
@ -296,7 +295,7 @@ Longest: 34</p>
|
||||
<td align="left">2</td>
|
||||
<td align="left">Staphylococcus coagulase-negative</td>
|
||||
<td align="right">313</td>
|
||||
<td align="right">15.7%</td>
|
||||
<td align="right">15.6%</td>
|
||||
<td align="right">780</td>
|
||||
<td align="right">39.0%</td>
|
||||
</tr>
|
||||
@ -304,7 +303,7 @@ Longest: 34</p>
|
||||
<td align="left">3</td>
|
||||
<td align="left">Staphylococcus aureus</td>
|
||||
<td align="right">235</td>
|
||||
<td align="right">11.8%</td>
|
||||
<td align="right">11.7%</td>
|
||||
<td align="right">1,015</td>
|
||||
<td align="right">50.7%</td>
|
||||
</tr>
|
||||
@ -314,13 +313,13 @@ Longest: 34</p>
|
||||
<td align="right">174</td>
|
||||
<td align="right">8.7%</td>
|
||||
<td align="right">1,189</td>
|
||||
<td align="right">59.5%</td>
|
||||
<td align="right">59.4%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">5</td>
|
||||
<td align="left">Streptococcus pneumoniae</td>
|
||||
<td align="right">117</td>
|
||||
<td align="right">5.9%</td>
|
||||
<td align="right">5.8%</td>
|
||||
<td align="right">1,306</td>
|
||||
<td align="right">65.3%</td>
|
||||
</tr>
|
||||
@ -328,7 +327,7 @@ Longest: 34</p>
|
||||
<td align="left">6</td>
|
||||
<td align="left">Staphylococcus hominis</td>
|
||||
<td align="right">81</td>
|
||||
<td align="right">4.1%</td>
|
||||
<td align="right">4.0%</td>
|
||||
<td align="right">1,387</td>
|
||||
<td align="right">69.4%</td>
|
||||
</tr>
|
||||
@ -338,7 +337,7 @@ Longest: 34</p>
|
||||
<td align="right">58</td>
|
||||
<td align="right">2.9%</td>
|
||||
<td align="right">1,445</td>
|
||||
<td align="right">72.3%</td>
|
||||
<td align="right">72.2%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">8</td>
|
||||
@ -368,7 +367,7 @@ Longest: 34</p>
|
||||
<td align="left">11</td>
|
||||
<td align="left">Serratia marcescens</td>
|
||||
<td align="right">25</td>
|
||||
<td align="right">1.3%</td>
|
||||
<td align="right">1.2%</td>
|
||||
<td align="right">1,575</td>
|
||||
<td align="right">78.8%</td>
|
||||
</tr>
|
||||
@ -384,7 +383,7 @@ Longest: 34</p>
|
||||
<td align="left">13</td>
|
||||
<td align="left">Enterococcus faecium</td>
|
||||
<td align="right">21</td>
|
||||
<td align="right">1.1%</td>
|
||||
<td align="right">1.0%</td>
|
||||
<td align="right">1,619</td>
|
||||
<td align="right">81.0%</td>
|
||||
</tr>
|
||||
@ -392,7 +391,7 @@ Longest: 34</p>
|
||||
<td align="left">14</td>
|
||||
<td align="left">Staphylococcus capitis</td>
|
||||
<td align="right">21</td>
|
||||
<td align="right">1.1%</td>
|
||||
<td align="right">1.0%</td>
|
||||
<td align="right">1,640</td>
|
||||
<td align="right">82.0%</td>
|
||||
</tr>
|
||||
@ -525,13 +524,13 @@ Unique: 4</p>
|
||||
<td align="right">663</td>
|
||||
<td align="right">33.2%</td>
|
||||
<td align="right">1,425</td>
|
||||
<td align="right">71.3%</td>
|
||||
<td align="right">71.2%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">A</td>
|
||||
<td align="right">321</td>
|
||||
<td align="right">16.1%</td>
|
||||
<td align="right">16.0%</td>
|
||||
<td align="right">1,746</td>
|
||||
<td align="right">87.3%</td>
|
||||
</tr>
|
||||
@ -567,9 +566,9 @@ Unique: 4</p>
|
||||
<td align="left">1</td>
|
||||
<td align="left">A</td>
|
||||
<td align="right">321</td>
|
||||
<td align="right">16.1%</td>
|
||||
<td align="right">16.0%</td>
|
||||
<td align="right">321</td>
|
||||
<td align="right">16.1%</td>
|
||||
<td align="right">16.0%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">2</td>
|
||||
@ -599,14 +598,15 @@ Unique: 4</p>
|
||||
</table>
|
||||
<p>All classes will be printed into the header (default is <code>FALSE</code> when using markdown like this document). Variables with the new <code>rsi</code> class of this AMR package are actually ordered factors and have three classes (look at <code>Class</code> in the header):</p>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1">septic_patients <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb9-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(amox, <span class="dt">header =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
|
||||
<p><strong>Frequency table of <code>amox</code> from a <code>data.frame</code> (2,000 x 49)</strong></p>
|
||||
<a class="sourceLine" id="cb9-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(AMX, <span class="dt">header =</span> <span class="ot">TRUE</span>)</a></code></pre></div>
|
||||
<p><strong>Frequency table of <code>AMX</code> from a <code>data.frame</code> (2,000 x 49)</strong></p>
|
||||
<p>Class: <code>factor</code> > <code>ordered</code> > <code>rsi</code> (<code>numeric</code>)<br>
|
||||
Length: 2,000 (of which NA: 771 = 38.55%)<br>
|
||||
Levels: 3: <code>S</code> < <code>I</code> < <code>R</code><br>
|
||||
Unique: 3</p>
|
||||
<p>Drug: Amoxicillin<br>
|
||||
%IR: 55.82%</p>
|
||||
<p>Drug: Amoxicillin (AMX, J01CA04)<br>
|
||||
Group: Beta-lactams/penicillins<br>
|
||||
%SI: 44.43%</p>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="left"></th>
|
||||
@ -705,7 +705,7 @@ Median: 31 July 2009 (47.39%)</p>
|
||||
<td align="right">7</td>
|
||||
<td align="right">0.4%</td>
|
||||
<td align="right">41</td>
|
||||
<td align="right">2.1%</td>
|
||||
<td align="right">2.0%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -731,14 +731,15 @@ Median: 31 July 2009 (47.39%)</p>
|
||||
</h3>
|
||||
<p>With the <code>na.rm</code> parameter (defaults to <code>TRUE</code>, but they will always be shown into the header), you can include <code>NA</code> values in the frequency table:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" title="1">septic_patients <span class="op">%>%</span></a>
|
||||
<a class="sourceLine" id="cb13-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(amox, <span class="dt">na.rm =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
|
||||
<p><strong>Frequency table of <code>amox</code> from a <code>data.frame</code> (2,000 x 49)</strong></p>
|
||||
<a class="sourceLine" id="cb13-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(AMX, <span class="dt">na.rm =</span> <span class="ot">FALSE</span>)</a></code></pre></div>
|
||||
<p><strong>Frequency table of <code>AMX</code> from a <code>data.frame</code> (2,000 x 49)</strong></p>
|
||||
<p>Class: <code>factor</code> > <code>ordered</code> > <code>rsi</code> (<code>numeric</code>)<br>
|
||||
Length: 2,000 (of which NA: 771 = 38.55%)<br>
|
||||
Levels: 3: <code>S</code> < <code>I</code> < <code>R</code><br>
|
||||
Unique: 4</p>
|
||||
<p>Drug: Amoxicillin<br>
|
||||
%IR: 55.82%</p>
|
||||
<p>Drug: Amoxicillin (AMX, J01CA04)<br>
|
||||
Group: Beta-lactams/penicillins<br>
|
||||
%SI: 44.43%</p>
|
||||
<table class="table">
|
||||
<thead><tr class="header">
|
||||
<th align="left"></th>
|
||||
@ -771,7 +772,7 @@ Unique: 4</p>
|
||||
<td align="right">543</td>
|
||||
<td align="right">27.2%</td>
|
||||
<td align="right">1,997</td>
|
||||
<td align="right">99.9%</td>
|
||||
<td align="right">99.8%</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td align="left">4</td>
|
||||
@ -817,12 +818,12 @@ Unique: 4</p>
|
||||
<td align="right">663</td>
|
||||
<td align="right">33.2%</td>
|
||||
<td align="right">1,425</td>
|
||||
<td align="right">71.3%</td>
|
||||
<td align="right">71.2%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">A</td>
|
||||
<td align="right">321</td>
|
||||
<td align="right">16.1%</td>
|
||||
<td align="right">16.0%</td>
|
||||
<td align="right">1,746</td>
|
||||
<td align="right">87.3%</td>
|
||||
</tr>
|
||||
@ -872,13 +873,13 @@ Unique: 4</p>
|
||||
<td align="right">663</td>
|
||||
<td align="right">33.2%</td>
|
||||
<td align="right">1,425</td>
|
||||
<td align="right">71.3%</td>
|
||||
<td align="right">71.2%</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td align="left">3</td>
|
||||
<td align="left">A</td>
|
||||
<td align="right">321</td>
|
||||
<td align="right">16.1%</td>
|
||||
<td align="right">16.0%</td>
|
||||
<td align="right">1,746</td>
|
||||
<td align="right">87.3%</td>
|
||||
</tr>
|
||||
|
@ -192,7 +192,7 @@
|
||||
<h1>How to predict antimicrobial resistance</h1>
|
||||
<h4 class="author">Matthijs S. Berends</h4>
|
||||
|
||||
<h4 class="date">10 May 2019</h4>
|
||||
<h4 class="date">12 May 2019</h4>
|
||||
|
||||
|
||||
<div class="hidden name"><code>resistance_predict.Rmd</code></div>
|
||||
|
@ -114,7 +114,7 @@ All classes will be printed into the header (default is `FALSE` when using markd
|
||||
|
||||
```{r, echo = TRUE}
|
||||
septic_patients %>%
|
||||
freq(amox, header = TRUE)
|
||||
freq(AMX, header = TRUE)
|
||||
```
|
||||
|
||||
## Frequencies of dates
|
||||
@ -148,7 +148,7 @@ With the `na.rm` parameter (defaults to `TRUE`, but they will always be shown in
|
||||
|
||||
```{r, echo = TRUE}
|
||||
septic_patients %>%
|
||||
freq(amox, na.rm = FALSE)
|
||||
freq(AMX, na.rm = FALSE)
|
||||
```
|
||||
|
||||
### Parameter `row.names`
|
||||
|