1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-27 10:06:12 +01:00

(v1.0.1) v 1.0.1

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-02-23 20:56:11 +01:00
parent 0d5e78b2cf
commit f444c24ed3
69 changed files with 773 additions and 1042 deletions

View File

@ -1,5 +1,5 @@
Package: AMR Package: AMR
Version: 1.0.0.9007 Version: 1.0.1
Date: 2020-02-22 Date: 2020-02-22
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(

View File

@ -1,9 +1,8 @@
# AMR 1.0.0.9007 # AMR 1.0.1
## <small>Last updated: 22-Feb-2020</small>
### Changed ### Changed
* Fixed floating point error for some MIC compa in EUCAST 2020 guideline * Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline
* Interpretation from MIC values to R/SI can now be used with `mutate_at()` of the dplyr package: * Interpretation from MIC values (and disk zones) to R/SI can now be used with `mutate_at()` of the `dplyr` package:
```r ```r
yourdata %>% yourdata %>%
mutate_at(vars(antibiotic1:antibiotic25), as.rsi, mo = "E. coli") mutate_at(vars(antibiotic1:antibiotic25), as.rsi, mo = "E. coli")

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.gitlab.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9007</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>

View File

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

View File

@ -39,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -179,7 +179,7 @@
<h1>How to conduct AMR analysis</h1> <h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">20 February 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>AMR.Rmd</code></div> <div class="hidden name"><code>AMR.Rmd</code></div>
@ -188,7 +188,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 20 February 2020.</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 23 February 2020.</p>
<div id="introduction" class="section level1"> <div id="introduction" class="section level1">
<h1 class="hasAnchor"> <h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1> <a href="#introduction" class="anchor"></a>Introduction</h1>
@ -219,21 +219,21 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2020-02-20</td> <td align="center">2020-02-23</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</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>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2020-02-20</td> <td align="center">2020-02-23</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">2020-02-20</td> <td align="center">2020-02-23</td>
<td align="center">efgh</td> <td align="center">efgh</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">R</td> <td align="center">R</td>
@ -328,70 +328,70 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2010-01-05</td> <td align="center">2014-10-31</td>
<td align="center">F4</td> <td align="center">B4</td>
<td align="center">Hospital A</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">2012-08-23</td>
<td align="center">J5</td>
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2016-06-20</td>
<td align="center">S1</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-05-08</td>
<td align="center">J3</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">2011-12-28</td>
<td align="center">T8</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td> <td align="center">Staphylococcus aureus</td>
<td align="center">S</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">2012-02-24</td>
<td align="center">E10</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">I</td> <td align="center">I</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">M</td>
</tr>
<tr class="odd">
<td align="center">2017-11-04</td>
<td align="center">G1</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2016-11-05</td> <td align="center">2011-10-08</td>
<td align="center">G9</td> <td align="center">V4</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2016-02-16</td>
<td align="center">K6</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2014-05-28</td>
<td align="center">N6</td>
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">Escherichia coli</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">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">M</td> <td align="center">S</td>
<td align="center">F</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -423,16 +423,16 @@ Unique: 2</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">M</td> <td align="left">M</td>
<td align="right">10,402</td> <td align="right">10,361</td>
<td align="right">52.01%</td> <td align="right">51.81%</td>
<td align="right">10,402</td> <td align="right">10,361</td>
<td align="right">52.01%</td> <td align="right">51.81%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">F</td> <td align="left">F</td>
<td align="right">9,598</td> <td align="right">9,639</td>
<td align="right">47.99%</td> <td align="right">48.20%</td>
<td align="right">20,000</td> <td align="right">20,000</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
@ -447,65 +447,7 @@ Unique: 2</p>
<span id="cb12-2"><a href="#cb12-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMX<span class="op">:</span>GEN), as.rsi)</span></code></pre></div> <span id="cb12-2"><a href="#cb12-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMX<span class="op">:</span>GEN), as.rsi)</span></code></pre></div>
<p>Finally, we will apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST rules</a> on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p> <p>Finally, we will apply <a href="http://www.eucast.org/expert_rules_and_intrinsic_resistance/">EUCAST rules</a> on our antimicrobial results. In Europe, most medical microbiological laboratories already apply these rules. Our package features their latest insights on intrinsic resistance and exceptional phenotypes. Moreover, the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function can also apply additional rules, like forcing <help title="ATC: J01CA01">ampicillin</help> = R when <help title="ATC: J01CR02">amoxicillin/clavulanic acid</help> = R.</p>
<p>Because the amoxicillin (column <code>AMX</code>) and amoxicillin/clavulanic acid (column <code>AMC</code>) in our data were generated randomly, some rows will undoubtedly contain AMX = S and AMC = R, which is technically impossible. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> fixes this:</p> <p>Because the amoxicillin (column <code>AMX</code>) and amoxicillin/clavulanic acid (column <code>AMC</code>) in our data were generated randomly, some rows will undoubtedly contain AMX = S and AMC = R, which is technically impossible. The <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> fixes this:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1"></a>data &lt;-<span class="st"> </span><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(data, <span class="dt">col_mo =</span> <span class="st">"bacteria"</span>)</span> <div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1"></a>data &lt;-<span class="st"> </span><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(data, <span class="dt">col_mo =</span> <span class="st">"bacteria"</span>)</span></code></pre></div>
<span id="cb13-2"><a href="#cb13-2"></a><span class="co"># </span></span>
<span id="cb13-3"><a href="#cb13-3"></a><span class="co"># Other rules by this AMR package</span></span>
<span id="cb13-4"><a href="#cb13-4"></a><span class="co"># Non-EUCAST: inherit amoxicillin results for unavailable ampicillin (no changes)</span></span>
<span id="cb13-5"><a href="#cb13-5"></a><span class="co"># Non-EUCAST: inherit ampicillin results for unavailable amoxicillin (no changes)</span></span>
<span id="cb13-6"><a href="#cb13-6"></a><span class="co"># Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,986 values changed)</span></span>
<span id="cb13-7"><a href="#cb13-7"></a><span class="co"># Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (157 values changed)</span></span>
<span id="cb13-8"><a href="#cb13-8"></a><span class="co"># Non-EUCAST: set piperacillin = R where piperacillin/tazobactam = R (no changes)</span></span>
<span id="cb13-9"><a href="#cb13-9"></a><span class="co"># Non-EUCAST: set piperacillin/tazobactam = S where piperacillin = S (no changes)</span></span>
<span id="cb13-10"><a href="#cb13-10"></a><span class="co"># Non-EUCAST: set trimethoprim = R where trimethoprim/sulfa = R (no changes)</span></span>
<span id="cb13-11"><a href="#cb13-11"></a><span class="co"># Non-EUCAST: set trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></span>
<span id="cb13-12"><a href="#cb13-12"></a><span class="co"># </span></span>
<span id="cb13-13"><a href="#cb13-13"></a><span class="co"># ----</span></span>
<span id="cb13-14"><a href="#cb13-14"></a><span class="co"># Rules by the European Committee on Antimicrobial Susceptibility Testing (EUCAST)</span></span>
<span id="cb13-15"><a href="#cb13-15"></a><span class="co"># http://eucast.org/</span></span>
<span id="cb13-16"><a href="#cb13-16"></a><span class="co"># </span></span>
<span id="cb13-17"><a href="#cb13-17"></a><span class="co"># EUCAST Clinical Breakpoints (v10.0, 2020)</span></span>
<span id="cb13-18"><a href="#cb13-18"></a><span class="co"># Aerococcus sanguinicola (no changes)</span></span>
<span id="cb13-19"><a href="#cb13-19"></a><span class="co"># Aerococcus urinae (no changes)</span></span>
<span id="cb13-20"><a href="#cb13-20"></a><span class="co"># Anaerobic Gram-negatives (no changes)</span></span>
<span id="cb13-21"><a href="#cb13-21"></a><span class="co"># Anaerobic Gram-positives (no changes)</span></span>
<span id="cb13-22"><a href="#cb13-22"></a><span class="co"># Burkholderia pseudomallei (no changes)</span></span>
<span id="cb13-23"><a href="#cb13-23"></a><span class="co"># Campylobacter coli (no changes)</span></span>
<span id="cb13-24"><a href="#cb13-24"></a><span class="co"># Campylobacter jejuni (no changes)</span></span>
<span id="cb13-25"><a href="#cb13-25"></a><span class="co"># Enterobacterales (Order) (no changes)</span></span>
<span id="cb13-26"><a href="#cb13-26"></a><span class="co"># Enterococcus (no changes)</span></span>
<span id="cb13-27"><a href="#cb13-27"></a><span class="co"># Haemophilus influenzae (no changes)</span></span>
<span id="cb13-28"><a href="#cb13-28"></a><span class="co"># Kingella kingae (no changes)</span></span>
<span id="cb13-29"><a href="#cb13-29"></a><span class="co"># Moraxella catarrhalis (no changes)</span></span>
<span id="cb13-30"><a href="#cb13-30"></a><span class="co"># Pasteurella multocida (no changes)</span></span>
<span id="cb13-31"><a href="#cb13-31"></a><span class="co"># Staphylococcus (no changes)</span></span>
<span id="cb13-32"><a href="#cb13-32"></a><span class="co"># Streptococcus groups A, B, C, G (no changes)</span></span>
<span id="cb13-33"><a href="#cb13-33"></a><span class="co"># Streptococcus pneumoniae (1,017 values changed)</span></span>
<span id="cb13-34"><a href="#cb13-34"></a><span class="co"># Viridans group streptococci (no changes)</span></span>
<span id="cb13-35"><a href="#cb13-35"></a><span class="co"># </span></span>
<span id="cb13-36"><a href="#cb13-36"></a><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></span>
<span id="cb13-37"><a href="#cb13-37"></a><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,297 values changed)</span></span>
<span id="cb13-38"><a href="#cb13-38"></a><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></span>
<span id="cb13-39"><a href="#cb13-39"></a><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></span>
<span id="cb13-40"><a href="#cb13-40"></a><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,752 values changed)</span></span>
<span id="cb13-41"><a href="#cb13-41"></a><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></span>
<span id="cb13-42"><a href="#cb13-42"></a><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></span>
<span id="cb13-43"><a href="#cb13-43"></a><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)</span></span>
<span id="cb13-44"><a href="#cb13-44"></a><span class="co"># Table 12: Interpretive rules for aminoglycosides (no changes)</span></span>
<span id="cb13-45"><a href="#cb13-45"></a><span class="co"># Table 13: Interpretive rules for quinolones (no changes)</span></span>
<span id="cb13-46"><a href="#cb13-46"></a><span class="co"># </span></span>
<span id="cb13-47"><a href="#cb13-47"></a><span class="co"># -------------------------------------------------------------------------------</span></span>
<span id="cb13-48"><a href="#cb13-48"></a><span class="co"># EUCAST rules affected 6,502 out of 20,000 rows, making a total of 8,209 edits</span></span>
<span id="cb13-49"><a href="#cb13-49"></a><span class="co"># =&gt; added 0 test results</span></span>
<span id="cb13-50"><a href="#cb13-50"></a><span class="co"># </span></span>
<span id="cb13-51"><a href="#cb13-51"></a><span class="co"># =&gt; changed 8,209 test results</span></span>
<span id="cb13-52"><a href="#cb13-52"></a><span class="co"># - 124 test results changed from S to I</span></span>
<span id="cb13-53"><a href="#cb13-53"></a><span class="co"># - 4,743 test results changed from S to R</span></span>
<span id="cb13-54"><a href="#cb13-54"></a><span class="co"># - 1,209 test results changed from I to S</span></span>
<span id="cb13-55"><a href="#cb13-55"></a><span class="co"># - 356 test results changed from I to R</span></span>
<span id="cb13-56"><a href="#cb13-56"></a><span class="co"># - 1,777 test results changed from R to S</span></span>
<span id="cb13-57"><a href="#cb13-57"></a><span class="co"># -------------------------------------------------------------------------------</span></span>
<span id="cb13-58"><a href="#cb13-58"></a><span class="co"># </span></span>
<span id="cb13-59"><a href="#cb13-59"></a><span class="co"># Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.</span></span></code></pre></div>
</div> </div>
<div id="adding-new-variables" class="section level1"> <div id="adding-new-variables" class="section level1">
<h1 class="hasAnchor"> <h1 class="hasAnchor">
@ -529,9 +471,8 @@ Unique: 2</p>
<span id="cb15-2"><a href="#cb15-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</span> <span id="cb15-2"><a href="#cb15-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">first =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(.))</span>
<span id="cb15-3"><a href="#cb15-3"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></span> <span id="cb15-3"><a href="#cb15-3"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></span>
<span id="cb15-4"><a href="#cb15-4"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span> <span id="cb15-4"><a href="#cb15-4"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span>
<span id="cb15-5"><a href="#cb15-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></span> <span id="cb15-5"><a href="#cb15-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></span></code></pre></div>
<span id="cb15-6"><a href="#cb15-6"></a><span class="co"># =&gt; Found 5,695 first isolates (28.5% of total)</span></span></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>
<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>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1"></a>data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></span> <div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1"></a>data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></span>
<span id="cb16-2"><a href="#cb16-2"></a><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>)</span></code></pre></div> <span id="cb16-2"><a href="#cb16-2"></a><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>)</span></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> <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>
@ -541,7 +482,7 @@ Unique: 2</p>
<div id="first-weighted-isolates" class="section level2"> <div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2> <a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient N2, sorted on date:</p> <p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient Q2, sorted on date:</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">isolate</th> <th align="center">isolate</th>
@ -557,8 +498,8 @@ Unique: 2</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-09</td> <td align="center">2010-02-26</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
@ -568,52 +509,63 @@ Unique: 2</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-03-02</td> <td align="center">2010-03-25</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-04-05</td> <td align="center">2010-05-23</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</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">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-05-19</td> <td align="center">2010-05-24</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">I</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-07-08</td> <td align="center">2010-09-08</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</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">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-08-09</td> <td align="center">2011-03-19</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-04-02</td>
<td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -621,45 +573,34 @@ Unique: 2</p>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-05-26</td>
<td align="center">N2</td>
<td align="center">B_ESCHR_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">TRUE</td>
</tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2011-05-26</td> <td align="center">2011-04-05</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">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">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2011-06-19</td> <td align="center">2011-11-13</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2011-07-29</td> <td align="center">2011-11-28</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</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">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -676,9 +617,7 @@ Unique: 2</p>
<span id="cb18-5"><a href="#cb18-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></span> <span id="cb18-5"><a href="#cb18-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></span>
<span id="cb18-6"><a href="#cb18-6"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span> <span id="cb18-6"><a href="#cb18-6"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span>
<span id="cb18-7"><a href="#cb18-7"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></span> <span id="cb18-7"><a href="#cb18-7"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></span>
<span id="cb18-8"><a href="#cb18-8"></a><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></span> <span id="cb18-8"><a href="#cb18-8"></a><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></span></code></pre></div>
<span id="cb18-9"><a href="#cb18-9"></a><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I</span></span>
<span id="cb18-10"><a href="#cb18-10"></a><span class="co"># =&gt; Found 15,096 first weighted isolates (75.5% of total)</span></span></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">isolate</th> <th align="center">isolate</th>
@ -695,8 +634,8 @@ Unique: 2</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-09</td> <td align="center">2010-02-26</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
@ -707,23 +646,23 @@ Unique: 2</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-03-02</td> <td align="center">2010-03-25</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-04-05</td> <td align="center">2010-05-23</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</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">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
@ -731,11 +670,11 @@ Unique: 2</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-05-19</td> <td align="center">2010-05-24</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">S</td>
<td align="center">I</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
@ -743,83 +682,83 @@ Unique: 2</p>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-07-08</td> <td align="center">2010-09-08</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</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">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-08-09</td> <td align="center">2011-03-19</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">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">TRUE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">7</td> <td align="center">7</td>
<td align="center">2011-05-26</td> <td align="center">2011-04-02</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">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> <td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2011-05-26</td> <td align="center">2011-04-05</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">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">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2011-06-19</td> <td align="center">2011-11-13</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">R</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2011-07-29</td> <td align="center">2011-11-28</td>
<td align="center">N2</td> <td align="center">Q2</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</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">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Instead of 2, now 9 isolates are flagged. In total, 75.5% of all isolates are marked first weighted - 47.0% 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 7 isolates are flagged. In total, 74.8% of all isolates are marked first weighted - 46.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>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</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="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1"></a>data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></span> <div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1"></a>data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></span>
<span id="cb19-2"><a href="#cb19-2"></a><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</span></code></pre></div> <span id="cb19-2"><a href="#cb19-2"></a><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</span></code></pre></div>
<p>So we end up with 15,096 isolates for analysis.</p> <p>So we end up with 14,960 isolates for analysis.</p>
<p>We can remove unneeded columns:</p> <p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1"></a>data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></span> <div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1"></a>data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></span>
<span id="cb20-2"><a href="#cb20-2"></a><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://rdrr.io/r/base/c.html">c</a></span>(first, keyab))</span></code></pre></div> <span id="cb20-2"><a href="#cb20-2"></a><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://rdrr.io/r/base/c.html">c</a></span>(first, keyab))</span></code></pre></div>
@ -827,7 +766,6 @@ Unique: 2</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1"></a><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(data_1st)</span></code></pre></div> <div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1"></a><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(data_1st)</span></code></pre></div>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th></th>
<th align="center">date</th> <th align="center">date</th>
<th align="center">patient_id</th> <th align="center">patient_id</th>
<th align="center">hospital</th> <th align="center">hospital</th>
@ -844,61 +782,87 @@ Unique: 2</p>
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td>1</td> <td align="center">2014-10-31</td>
<td align="center">2010-01-05</td> <td align="center">B4</td>
<td align="center">F4</td> <td align="center">Hospital B</td>
<td align="center">Hospital A</td> <td align="center">B_STPHY_AURS</td>
<td align="center">B_STRPT_PNMN</td> <td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-02-24</td>
<td align="center">E10</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<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 align="center">2017-11-04</td>
<td align="center">G1</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2011-10-08</td>
<td align="center">V4</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2016-02-16</td>
<td align="center">K6</td>
<td align="center">Hospital D</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</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">M</td>
<td align="center">Gram-positive</td> <td align="center">Gram-positive</td>
<td align="center">Streptococcus</td> <td align="center">Staphylococcus</td>
<td align="center">pneumoniae</td> <td align="center">aureus</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td>6</td> <td align="center">2014-05-28</td>
<td align="center">2016-11-05</td> <td align="center">N6</td>
<td align="center">G9</td>
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_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">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>7</td>
<td align="center">2016-05-20</td>
<td align="center">A10</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_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>
<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>9</td>
<td align="center">2015-10-02</td>
<td align="center">R3</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COLI</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">S</td>
<td align="center">F</td> <td align="center">F</td>
@ -907,38 +871,6 @@ Unique: 2</p>
<td align="center">coli</td> <td align="center">coli</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd">
<td>10</td>
<td align="center">2016-03-04</td>
<td align="center">B10</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_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>
<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>11</td>
<td align="center">2013-09-10</td>
<td align="center">P4</td>
<td align="center">Hospital B</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
</tbody> </tbody>
</table> </table>
<p>Time for the analysis!</p> <p>Time for the analysis!</p>
@ -958,8 +890,8 @@ Unique: 2</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(genus, species)</span></code></pre></div> <div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(genus, species)</span></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: character<br> <p>Class: character<br>
Length: 15,096<br> Length: 14,960<br>
Available: 15,096 (100%, NA: 0 = 0%)<br> Available: 14,960 (100%, NA: 0 = 0%)<br>
Unique: 4</p> Unique: 4</p>
<p>Shortest: 16<br> <p>Shortest: 16<br>
Longest: 24</p> Longest: 24</p>
@ -976,33 +908,33 @@ Longest: 24</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">Escherichia coli</td> <td align="left">Escherichia coli</td>
<td align="right">7,491</td> <td align="right">7,397</td>
<td align="right">49.62%</td> <td align="right">49.45%</td>
<td align="right">7,491</td> <td align="right">7,397</td>
<td align="right">49.62%</td> <td align="right">49.45%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Staphylococcus aureus</td> <td align="left">Staphylococcus aureus</td>
<td align="right">3,729</td> <td align="right">3,685</td>
<td align="right">24.70%</td> <td align="right">24.63%</td>
<td align="right">11,220</td> <td align="right">11,082</td>
<td align="right">74.32%</td> <td align="right">74.08%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">3</td> <td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td> <td align="left">Streptococcus pneumoniae</td>
<td align="right">2,340</td> <td align="right">2,361</td>
<td align="right">15.50%</td> <td align="right">15.78%</td>
<td align="right">13,560</td> <td align="right">13,443</td>
<td align="right">89.83%</td> <td align="right">89.86%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">4</td> <td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td> <td align="left">Klebsiella pneumoniae</td>
<td align="right">1,536</td> <td align="right">1,517</td>
<td align="right">10.17%</td> <td align="right">10.14%</td>
<td align="right">15,096</td> <td align="right">14,960</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
</tbody> </tbody>
@ -1014,7 +946,7 @@ Longest: 24</p>
<p>The functions <code><a href="../reference/proportion.html">resistance()</a></code> and <code><a href="../reference/proportion.html">susceptibility()</a></code> can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions <code><a href="../reference/proportion.html">proportion_S()</a></code>, <code><a href="../reference/proportion.html">proportion_SI()</a></code>, <code><a href="../reference/proportion.html">proportion_I()</a></code>, <code><a href="../reference/proportion.html">proportion_IR()</a></code> and <code><a href="../reference/proportion.html">proportion_R()</a></code> can be used to determine the proportion of a specific antimicrobial outcome.</p> <p>The functions <code><a href="../reference/proportion.html">resistance()</a></code> and <code><a href="../reference/proportion.html">susceptibility()</a></code> can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions <code><a href="../reference/proportion.html">proportion_S()</a></code>, <code><a href="../reference/proportion.html">proportion_SI()</a></code>, <code><a href="../reference/proportion.html">proportion_I()</a></code>, <code><a href="../reference/proportion.html">proportion_IR()</a></code> and <code><a href="../reference/proportion.html">proportion_R()</a></code> can be used to determine the proportion of a specific antimicrobial outcome.</p>
<p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p> <p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMX)</span> <div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/proportion.html">resistance</a></span>(AMX)</span>
<span id="cb24-2"><a href="#cb24-2"></a><span class="co"># [1] 0.4681373</span></span></code></pre></div> <span id="cb24-2"><a href="#cb24-2"></a><span class="co"># [1] 0.4635695</span></span></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> <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="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span></span> <div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1"></a>data_1st <span class="op">%&gt;%</span><span class="st"> </span></span>
<span id="cb25-2"><a href="#cb25-2"></a><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></span> <span id="cb25-2"><a href="#cb25-2"></a><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></span>
@ -1027,19 +959,19 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.4648446</td> <td align="center">0.4490022</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.4689223</td> <td align="center">0.4746786</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.4656180</td> <td align="center">0.4505104</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.4734787</td> <td align="center">0.4760039</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1057,23 +989,23 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.4648446</td> <td align="center">0.4490022</td>
<td align="center">4537</td> <td align="center">4510</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.4689223</td> <td align="center">0.4746786</td>
<td align="center">5261</td> <td align="center">5134</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.4656180</td> <td align="center">0.4505104</td>
<td align="center">2225</td> <td align="center">2253</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.4734787</td> <td align="center">0.4760039</td>
<td align="center">3073</td> <td align="center">3063</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1093,27 +1025,27 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Escherichia</td> <td align="center">Escherichia</td>
<td align="center">0.9255106</td> <td align="center">0.9251048</td>
<td align="center">0.8972100</td> <td align="center">0.8952278</td>
<td align="center">0.9937258</td> <td align="center">0.9928349</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Klebsiella</td> <td align="center">Klebsiella</td>
<td align="center">0.9199219</td> <td align="center">0.9169413</td>
<td align="center">0.8932292</td> <td align="center">0.9083718</td>
<td align="center">0.9934896</td> <td align="center">0.9947264</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Staphylococcus</td> <td align="center">Staphylococcus</td>
<td align="center">0.9187450</td> <td align="center">0.9305292</td>
<td align="center">0.9133816</td> <td align="center">0.9158752</td>
<td align="center">0.9924913</td> <td align="center">0.9937585</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Streptococcus</td> <td align="center">Streptococcus</td>
<td align="center">0.6128205</td> <td align="center">0.6027107</td>
<td align="center">0.0000000</td> <td align="center">0.0000000</td>
<td align="center">0.6128205</td> <td align="center">0.6027107</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -39,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -179,7 +179,7 @@
<h1>How to apply EUCAST rules</h1> <h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">20 February 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></div> <div class="hidden name"><code>EUCAST.Rmd</code></div>

View File

@ -16,9 +16,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous"> <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script><meta property="og:title" content="How to determine multi-drug resistance (MDR)"> <script src="../extra.js"></script><meta property="og:title" content="How to determine multi-drug resistance (MDR)">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png"> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
@ -41,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -166,13 +164,7 @@
</a> </a>
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div> </div>
</form>
</div>
<!--/.nav-collapse --> <!--/.nav-collapse -->
</div> </div>
<!--/.container --> <!--/.container -->
@ -187,7 +179,7 @@
<h1>How to determine multi-drug resistance (MDR)</h1> <h1>How to determine multi-drug resistance (MDR)</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">26 January 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>MDR.Rmd</code></div> <div class="hidden name"><code>MDR.Rmd</code></div>
@ -210,16 +202,20 @@
<ul> <ul>
<li> <li>
<p><code>guideline = "CMI2012"</code> (default)</p> <p><code>guideline = "CMI2012"</code> (default)</p>
Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext">link</a>)</li> <p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext">link</a>)</p>
</li>
<li> <li>
<p><code>guideline = "EUCAST"</code></p> <p><code>guideline = "EUCAST"</code></p>
The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf">link</a>)</li> <p>The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf">link</a>)</p>
</li>
<li> <li>
<p><code>guideline = "TB"</code></p> <p><code>guideline = "TB"</code></p>
The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/">link</a>)</li> <p>The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/">link</a>)</p>
</li>
<li> <li>
<p><code>guideline = "MRGN"</code></p> <p><code>guideline = "MRGN"</code></p>
The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. (<a href="https://doi.org/10.1186/s13756-015-0047-6">link</a>)</li> <p>The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. (<a href="https://doi.org/10.1186/s13756-015-0047-6">link</a>)</p>
</li>
<li> <li>
<p><code>guideline = "BRMO"</code></p> <p><code>guideline = "BRMO"</code></p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]” (<a href="https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH">link</a>)</p> <p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]” (<a href="https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH">link</a>)</p>
@ -231,24 +227,20 @@ The German national guideline - Mueller et al. (2015) Antimicrobial Resistance a
<a href="#examples" class="anchor"></a>Examples</h4> <a href="#examples" class="anchor"></a>Examples</h4>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels Negative, MDR, XDR or PDR in that order.</p> <p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels Negative, MDR, XDR or PDR in that order.</p>
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p> <p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># to support pipes: %&gt;%</span></a></code></pre></div> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># to support pipes: %&gt;%</span></span></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">example_isolates <span class="op">%&gt;%</span><span class="st"> </span></a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a>example_isolates <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdro</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb2-2"><a href="#cb2-2"></a><span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdro</a></span>() <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>() <span class="co"># show frequency table of the result</span></a> <span id="cb2-3"><a href="#cb2-3"></a><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>() <span class="co"># show frequency table of the result</span></span>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></a> <span id="cb2-4"><a href="#cb2-4"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `mo` as input for `col_mo`.</span></span>
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></a> <span id="cb2-5"><a href="#cb2-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></span>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: SAM (ampicillin/sulbactam), ATM (aztreonam), CTT (cefotetan), CPT (ceftaroline), DAP (daptomycin), DOR (doripenem), ETP (ertapenem), FUS (fusidic acid), GEH (gentamicin-high), LVX (levofloxacin), MNO (minocycline), NET (netilmicin), PLB (polymyxin B), QDA (quinupristin/dalfopristin), STH (streptomycin-high), TLV (telavancin), TCC (ticarcillin/clavulanic acid)</span></a> <span id="cb2-6"><a href="#cb2-6"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: SAM (ampicillin/sulbactam), ATM (aztreonam), CTT (cefotetan), CPT (ceftaroline), DAP (daptomycin), DOR (doripenem), ETP (ertapenem), FUS (fusidic acid), GEH (gentamicin-high), LVX (levofloxacin), MNO (minocycline), NET (netilmicin), PLB (polymyxin B), QDA (quinupristin/dalfopristin), STH (streptomycin-high), TLV (telavancin), TCC (ticarcillin/clavulanic acid)</span></span>
<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="co"># Table 1 - Staphylococcus aureus ... OK</span></a> <span id="cb2-7"><a href="#cb2-7"></a><span class="co"># Warning in mdro(.): NA introduced for isolates where the available percentage of</span></span>
<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="co"># Table 2 - Enterococcus spp. ... OK</span></a> <span id="cb2-8"><a href="#cb2-8"></a><span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></span></code></pre></div>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="co"># Table 3 - Enterobacteriaceae ... OK</span></a>
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># Table 4 - Pseudomonas aeruginosa ... OK</span></a>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># Table 5 - Acinetobacter spp. ... OK</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># Warning in mdro(.): NA introduced for isolates where the available percentage of</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></a></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered (numeric)<br> <p>Class: factor &gt; ordered (numeric)<br>
Length: 2,000 (of which NA: 289 = 14.45%)<br> Length: 2,000<br>
Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively drug-resistant …<br> Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively drug-resistant …<br>
Available: 1,711 (85.55%, NA: 289 = 14.45%)<br>
Unique: 2</p> Unique: 2</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
@ -279,69 +271,60 @@ Unique: 2</p>
</tbody> </tbody>
</table> </table>
<p>For another example, I will create a data set to determine multi-drug resistant TB:</p> <p>For another example, I will create a data set to determine multi-drug resistant TB:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="co"># a helper function to get a random vector with values S, I and R</span></a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a><span class="co"># a helper function to get a random vector with values S, I and R</span></span>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="co"># with the probabilities 50% - 10% - 40%</span></a> <span id="cb3-2"><a href="#cb3-2"></a><span class="co"># with the probabilities 50% - 10% - 40%</span></span>
<a class="sourceLine" id="cb3-3" data-line-number="3">sample_rsi &lt;-<span class="st"> </span><span class="cf">function</span>() {</a> <span id="cb3-3"><a href="#cb3-3"></a>sample_rsi &lt;-<span class="st"> </span><span class="cf">function</span>() {</span>
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),</a> <span id="cb3-4"><a href="#cb3-4"></a> <span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),</span>
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="dt">size =</span> <span class="dv">5000</span>,</a> <span id="cb3-5"><a href="#cb3-5"></a> <span class="dt">size =</span> <span class="dv">5000</span>,</span>
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">prob =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.5</span>, <span class="fl">0.1</span>, <span class="fl">0.4</span>),</a> <span id="cb3-6"><a href="#cb3-6"></a> <span class="dt">prob =</span> <span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.5</span>, <span class="fl">0.1</span>, <span class="fl">0.4</span>),</span>
<a class="sourceLine" id="cb3-7" data-line-number="7"> <span class="dt">replace =</span> <span class="ot">TRUE</span>)</a> <span id="cb3-7"><a href="#cb3-7"></a> <span class="dt">replace =</span> <span class="ot">TRUE</span>)</span>
<a class="sourceLine" id="cb3-8" data-line-number="8">}</a> <span id="cb3-8"><a href="#cb3-8"></a>}</span>
<a class="sourceLine" id="cb3-9" data-line-number="9"></a> <span id="cb3-9"><a href="#cb3-9"></a></span>
<a class="sourceLine" id="cb3-10" data-line-number="10">my_TB_data &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">rifampicin =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-10"><a href="#cb3-10"></a>my_TB_data &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">rifampicin =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-11" data-line-number="11"> <span class="dt">isoniazid =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-11"><a href="#cb3-11"></a> <span class="dt">isoniazid =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-12" data-line-number="12"> <span class="dt">gatifloxacin =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-12"><a href="#cb3-12"></a> <span class="dt">gatifloxacin =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-13" data-line-number="13"> <span class="dt">ethambutol =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-13"><a href="#cb3-13"></a> <span class="dt">ethambutol =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-14" data-line-number="14"> <span class="dt">pyrazinamide =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-14"><a href="#cb3-14"></a> <span class="dt">pyrazinamide =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-15" data-line-number="15"> <span class="dt">moxifloxacin =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb3-15"><a href="#cb3-15"></a> <span class="dt">moxifloxacin =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb3-16" data-line-number="16"> <span class="dt">kanamycin =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div> <span id="cb3-16"><a href="#cb3-16"></a> <span class="dt">kanamycin =</span> <span class="kw">sample_rsi</span>())</span></code></pre></div>
<p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:</p> <p>Because all column names are automatically verified for valid drug names or codes, this would have worked exactly the same:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">my_TB_data &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">RIF =</span> <span class="kw">sample_rsi</span>(),</a> <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a>my_TB_data &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">RIF =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="dt">INH =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb4-2"><a href="#cb4-2"></a> <span class="dt">INH =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-3" data-line-number="3"> <span class="dt">GAT =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb4-3"><a href="#cb4-3"></a> <span class="dt">GAT =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-4" data-line-number="4"> <span class="dt">ETH =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb4-4"><a href="#cb4-4"></a> <span class="dt">ETH =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-5" data-line-number="5"> <span class="dt">PZA =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb4-5"><a href="#cb4-5"></a> <span class="dt">PZA =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-6" data-line-number="6"> <span class="dt">MFX =</span> <span class="kw">sample_rsi</span>(),</a> <span id="cb4-6"><a href="#cb4-6"></a> <span class="dt">MFX =</span> <span class="kw">sample_rsi</span>(),</span>
<a class="sourceLine" id="cb4-7" data-line-number="7"> <span class="dt">KAN =</span> <span class="kw">sample_rsi</span>())</a></code></pre></div> <span id="cb4-7"><a href="#cb4-7"></a> <span class="dt">KAN =</span> <span class="kw">sample_rsi</span>())</span></code></pre></div>
<p>The data set now looks like this:</p> <p>The data set now looks like this:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(my_TB_data)</a> <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="kw"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(my_TB_data)</span>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></a> <span id="cb5-2"><a href="#cb5-2"></a><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></span>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co"># 1 I S R S S R</span></a> <span id="cb5-3"><a href="#cb5-3"></a><span class="co"># 1 S R S R R I</span></span>
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="co"># 2 S R R R S S</span></a> <span id="cb5-4"><a href="#cb5-4"></a><span class="co"># 2 S R S S R S</span></span>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="co"># 3 S S R S R I</span></a> <span id="cb5-5"><a href="#cb5-5"></a><span class="co"># 3 I S R R S R</span></span>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co"># 4 S S S R S R</span></a> <span id="cb5-6"><a href="#cb5-6"></a><span class="co"># 4 S S S S S R</span></span>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># 5 R S S S S I</span></a> <span id="cb5-7"><a href="#cb5-7"></a><span class="co"># 5 S S S I R R</span></span>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># 6 S S R R R S</span></a> <span id="cb5-8"><a href="#cb5-8"></a><span class="co"># 6 I I R R S S</span></span>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># kanamycin</span></a> <span id="cb5-9"><a href="#cb5-9"></a><span class="co"># kanamycin</span></span>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># 1 S</span></a> <span id="cb5-10"><a href="#cb5-10"></a><span class="co"># 1 S</span></span>
<a class="sourceLine" id="cb5-11" data-line-number="11"><span class="co"># 2 S</span></a> <span id="cb5-11"><a href="#cb5-11"></a><span class="co"># 2 I</span></span>
<a class="sourceLine" id="cb5-12" data-line-number="12"><span class="co"># 3 R</span></a> <span id="cb5-12"><a href="#cb5-12"></a><span class="co"># 3 R</span></span>
<a class="sourceLine" id="cb5-13" data-line-number="13"><span class="co"># 4 I</span></a> <span id="cb5-13"><a href="#cb5-13"></a><span class="co"># 4 R</span></span>
<a class="sourceLine" id="cb5-14" data-line-number="14"><span class="co"># 5 S</span></a> <span id="cb5-14"><a href="#cb5-14"></a><span class="co"># 5 R</span></span>
<a class="sourceLine" id="cb5-15" data-line-number="15"><span class="co"># 6 R</span></a></code></pre></div> <span id="cb5-15"><a href="#cb5-15"></a><span class="co"># 6 I</span></span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p> <p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/mdro.html">mdro</a></span>(my_TB_data, <span class="dt">guideline =</span> <span class="st">"TB"</span>)</a></code></pre></div> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a><span class="kw"><a href="../reference/mdro.html">mdro</a></span>(my_TB_data, <span class="dt">guideline =</span> <span class="st">"TB"</span>)</span></code></pre></div>
<p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p> <p>or its shortcut <code><a href="../reference/mdro.html">mdr_tb()</a></code>:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">my_TB_data<span class="op">$</span>mdr &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdr_tb</a></span>(my_TB_data)</a> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a>my_TB_data<span class="op">$</span>mdr &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdr_tb</a></span>(my_TB_data)</span>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># </span><span class="al">NOTE</span><span class="co">: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.</span></a> <span id="cb7-2"><a href="#cb7-2"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: No column found as input for `col_mo`, assuming all records contain Mycobacterium tuberculosis.</span></span>
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></a> <span id="cb7-3"><a href="#cb7-3"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Auto-guessing columns suitable for analysis...OK.</span></span>
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)</span></a> <span id="cb7-4"><a href="#cb7-4"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability will be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)</span></span></code></pre></div>
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co"># </span></a>
<a class="sourceLine" id="cb7-6" data-line-number="6"><span class="co"># Only results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.</span></a>
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="co"># </span></a>
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># Determining multidrug-resistant organisms (MDRO), according to:</span></a>
<a class="sourceLine" id="cb7-9" data-line-number="9"><span class="co"># Guideline: Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis</span></a>
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="co"># Version: WHO/HTM/TB/2014.11</span></a>
<a class="sourceLine" id="cb7-11" data-line-number="11"><span class="co"># Author: WHO (World Health Organization)</span></a>
<a class="sourceLine" id="cb7-12" data-line-number="12"><span class="co"># Source: https://www.who.int/tb/publications/pmdt_companionhandbook/en/</span></a>
<a class="sourceLine" id="cb7-13" data-line-number="13"><span class="co"># </span></a>
<a class="sourceLine" id="cb7-14" data-line-number="14"><span class="co"># =&gt; Found 4338 MDROs out of 5000 tested isolates (86.8%)</span></a></code></pre></div>
<p>Create a frequency table of the results:</p> <p>Create a frequency table of the results:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</a></code></pre></div> <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</span></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered (numeric)<br> <p>Class: factor &gt; ordered (numeric)<br>
Length: 5,000 (of which NA: 0 = 0%)<br> Length: 5,000<br>
Levels: 5: Negative &lt; Mono-resistant &lt; Poly-resistant &lt; Multi-drug-resistant &lt;<br> Levels: 5: Negative &lt; Mono-resistant &lt; Poly-resistant &lt; Multi-drug-resistant &lt;<br>
Available: 5,000 (100%, NA: 0 = 0%)<br>
Unique: 5</p> Unique: 5</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
@ -356,40 +339,40 @@ Unique: 5</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">Mono-resistant</td> <td align="left">Mono-resistant</td>
<td align="right">3217</td> <td align="right">3274</td>
<td align="right">64.34%</td> <td align="right">65.48%</td>
<td align="right">3217</td> <td align="right">3274</td>
<td align="right">64.34%</td> <td align="right">65.48%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Negative</td> <td align="left">Negative</td>
<td align="right">662</td> <td align="right">651</td>
<td align="right">13.24%</td> <td align="right">13.02%</td>
<td align="right">3879</td> <td align="right">3925</td>
<td align="right">77.58%</td> <td align="right">78.50%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">3</td> <td align="left">3</td>
<td align="left">Multi-drug-resistant</td> <td align="left">Multi-drug-resistant</td>
<td align="right">632</td> <td align="right">612</td>
<td align="right">12.64%</td> <td align="right">12.24%</td>
<td align="right">4511</td> <td align="right">4537</td>
<td align="right">90.22%</td> <td align="right">90.74%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">4</td> <td align="left">4</td>
<td align="left">Poly-resistant</td> <td align="left">Poly-resistant</td>
<td align="right">280</td> <td align="right">288</td>
<td align="right">5.60%</td> <td align="right">5.76%</td>
<td align="right">4791</td> <td align="right">4825</td>
<td align="right">95.82%</td> <td align="right">96.50%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">5</td> <td align="left">5</td>
<td align="left">Extensively drug-resistant</td> <td align="left">Extensively drug-resistant</td>
<td align="right">209</td> <td align="right">175</td>
<td align="right">4.18%</td> <td align="right">3.50%</td>
<td align="right">5000</td> <td align="right">5000</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
@ -418,20 +401,7 @@ Unique: 5</p>
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e', </body>
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html> </html>

View File

@ -16,9 +16,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous"> <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script><meta property="og:title" content="How to import data from SPSS / SAS / Stata"> <script src="../extra.js"></script><meta property="og:title" content="How to import data from SPSS / SAS / Stata">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png"> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
@ -41,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -166,13 +164,7 @@
</a> </a>
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div> </div>
</form>
</div>
<!--/.nav-collapse --> <!--/.nav-collapse -->
</div> </div>
<!--/.container --> <!--/.container -->
@ -187,7 +179,7 @@
<h1>How to import data from SPSS / SAS / Stata</h1> <h1>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">26 January 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>SPSS.Rmd</code></div> <div class="hidden name"><code>SPSS.Rmd</code></div>
@ -241,39 +233,39 @@
</li> </li>
</ul> </ul>
<p>To demonstrate the first point:</p> <p>To demonstrate the first point:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="co"># not all values are valid MIC values:</span></a> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="co"># not all values are valid MIC values:</span></span>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="../reference/as.mic.html">as.mic</a></span>(<span class="fl">0.125</span>)</a> <span id="cb1-2"><a href="#cb1-2"></a><span class="kw"><a href="../reference/as.mic.html">as.mic</a></span>(<span class="fl">0.125</span>)</span>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="co"># Class 'mic'</span></a> <span id="cb1-3"><a href="#cb1-3"></a><span class="co"># Class 'mic'</span></span>
<a class="sourceLine" id="cb1-4" data-line-number="4"><span class="co"># [1] 0.125</span></a> <span id="cb1-4"><a href="#cb1-4"></a><span class="co"># [1] 0.125</span></span>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="kw"><a href="../reference/as.mic.html">as.mic</a></span>(<span class="st">"testvalue"</span>)</a> <span id="cb1-5"><a href="#cb1-5"></a><span class="kw"><a href="../reference/as.mic.html">as.mic</a></span>(<span class="st">"testvalue"</span>)</span>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co"># Class 'mic'</span></a> <span id="cb1-6"><a href="#cb1-6"></a><span class="co"># Class 'mic'</span></span>
<a class="sourceLine" id="cb1-7" data-line-number="7"><span class="co"># [1] &lt;NA&gt;</span></a> <span id="cb1-7"><a href="#cb1-7"></a><span class="co"># [1] &lt;NA&gt;</span></span>
<a class="sourceLine" id="cb1-8" data-line-number="8"></a> <span id="cb1-8"><a href="#cb1-8"></a></span>
<a class="sourceLine" id="cb1-9" data-line-number="9"><span class="co"># the Gram stain is avaiable for all bacteria:</span></a> <span id="cb1-9"><a href="#cb1-9"></a><span class="co"># the Gram stain is avaiable for all bacteria:</span></span>
<a class="sourceLine" id="cb1-10" data-line-number="10"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a> <span id="cb1-10"><a href="#cb1-10"></a><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</span>
<a class="sourceLine" id="cb1-11" data-line-number="11"><span class="co"># [1] "Gram-negative"</span></a> <span id="cb1-11"><a href="#cb1-11"></a><span class="co"># [1] "Gram-negative"</span></span>
<a class="sourceLine" id="cb1-12" data-line-number="12"></a> <span id="cb1-12"><a href="#cb1-12"></a></span>
<a class="sourceLine" id="cb1-13" data-line-number="13"><span class="co"># Klebsiella is intrinsic resistant to amoxicllin, according to EUCAST:</span></a> <span id="cb1-13"><a href="#cb1-13"></a><span class="co"># Klebsiella is intrinsic resistant to amoxicllin, according to EUCAST:</span></span>
<a class="sourceLine" id="cb1-14" data-line-number="14">klebsiella_test &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">mo =</span> <span class="st">"klebsiella"</span>, </a> <span id="cb1-14"><a href="#cb1-14"></a>klebsiella_test &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span>(<span class="dt">mo =</span> <span class="st">"klebsiella"</span>, </span>
<a class="sourceLine" id="cb1-15" data-line-number="15"> <span class="dt">amox =</span> <span class="st">"S"</span>,</a> <span id="cb1-15"><a href="#cb1-15"></a> <span class="dt">amox =</span> <span class="st">"S"</span>,</span>
<a class="sourceLine" id="cb1-16" data-line-number="16"> <span class="dt">stringsAsFactors =</span> <span class="ot">FALSE</span>)</a> <span id="cb1-16"><a href="#cb1-16"></a> <span class="dt">stringsAsFactors =</span> <span class="ot">FALSE</span>)</span>
<a class="sourceLine" id="cb1-17" data-line-number="17">klebsiella_test <span class="co"># (our original data)</span></a> <span id="cb1-17"><a href="#cb1-17"></a>klebsiella_test <span class="co"># (our original data)</span></span>
<a class="sourceLine" id="cb1-18" data-line-number="18"><span class="co"># mo amox</span></a> <span id="cb1-18"><a href="#cb1-18"></a><span class="co"># mo amox</span></span>
<a class="sourceLine" id="cb1-19" data-line-number="19"><span class="co"># 1 klebsiella S</span></a> <span id="cb1-19"><a href="#cb1-19"></a><span class="co"># 1 klebsiella S</span></span>
<a class="sourceLine" id="cb1-20" data-line-number="20"><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(klebsiella_test, <span class="dt">info =</span> <span class="ot">FALSE</span>) <span class="co"># (the edited data by EUCAST rules)</span></a> <span id="cb1-20"><a href="#cb1-20"></a><span class="kw"><a href="../reference/eucast_rules.html">eucast_rules</a></span>(klebsiella_test, <span class="dt">info =</span> <span class="ot">FALSE</span>) <span class="co"># (the edited data by EUCAST rules)</span></span>
<a class="sourceLine" id="cb1-21" data-line-number="21"><span class="co"># mo amox</span></a> <span id="cb1-21"><a href="#cb1-21"></a><span class="co"># mo amox</span></span>
<a class="sourceLine" id="cb1-22" data-line-number="22"><span class="co"># 1 klebsiella R</span></a> <span id="cb1-22"><a href="#cb1-22"></a><span class="co"># 1 klebsiella R</span></span>
<a class="sourceLine" id="cb1-23" data-line-number="23"></a> <span id="cb1-23"><a href="#cb1-23"></a></span>
<a class="sourceLine" id="cb1-24" data-line-number="24"><span class="co"># hundreds of trade names can be translated to a name, trade name or an ATC code:</span></a> <span id="cb1-24"><a href="#cb1-24"></a><span class="co"># hundreds of trade names can be translated to a name, trade name or an ATC code:</span></span>
<a class="sourceLine" id="cb1-25" data-line-number="25"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="st">"floxapen"</span>)</a> <span id="cb1-25"><a href="#cb1-25"></a><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="st">"floxapen"</span>)</span>
<a class="sourceLine" id="cb1-26" data-line-number="26"><span class="co"># [1] "Flucloxacillin"</span></a> <span id="cb1-26"><a href="#cb1-26"></a><span class="co"># [1] "Flucloxacillin"</span></span>
<a class="sourceLine" id="cb1-27" data-line-number="27"><span class="kw"><a href="../reference/ab_property.html">ab_tradenames</a></span>(<span class="st">"floxapen"</span>)</a> <span id="cb1-27"><a href="#cb1-27"></a><span class="kw"><a href="../reference/ab_property.html">ab_tradenames</a></span>(<span class="st">"floxapen"</span>)</span>
<a class="sourceLine" id="cb1-28" data-line-number="28"><span class="co"># [1] "Floxacillin" "FLOXACILLIN" "Floxapen" </span></a> <span id="cb1-28"><a href="#cb1-28"></a><span class="co"># [1] "Floxacillin" "FLOXACILLIN" "Floxapen" </span></span>
<a class="sourceLine" id="cb1-29" data-line-number="29"><span class="co"># [4] "Floxapen sodium salt" "Fluclox" "Flucloxacilina" </span></a> <span id="cb1-29"><a href="#cb1-29"></a><span class="co"># [4] "Floxapen sodium salt" "Fluclox" "Flucloxacilina" </span></span>
<a class="sourceLine" id="cb1-30" data-line-number="30"><span class="co"># [7] "Flucloxacillin" "Flucloxacilline" "Flucloxacillinum" </span></a> <span id="cb1-30"><a href="#cb1-30"></a><span class="co"># [7] "Flucloxacillin" "Flucloxacilline" "Flucloxacillinum" </span></span>
<a class="sourceLine" id="cb1-31" data-line-number="31"><span class="co"># [10] "Fluorochloroxacillin"</span></a> <span id="cb1-31"><a href="#cb1-31"></a><span class="co"># [10] "Fluorochloroxacillin"</span></span>
<a class="sourceLine" id="cb1-32" data-line-number="32"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="st">"floxapen"</span>)</a> <span id="cb1-32"><a href="#cb1-32"></a><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="st">"floxapen"</span>)</span>
<a class="sourceLine" id="cb1-33" data-line-number="33"><span class="co"># [1] "J01CF05"</span></a></code></pre></div> <span id="cb1-33"><a href="#cb1-33"></a><span class="co"># [1] "J01CF05"</span></span></code></pre></div>
</div> </div>
<div id="import-data-from-spsssasstata" class="section level2"> <div id="import-data-from-spsssasstata" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
@ -289,97 +281,97 @@
<p><img src="https://gitlab.com/msberends/AMR/raw/master/docs/import2.png"></p> <p><img src="https://gitlab.com/msberends/AMR/raw/master/docs/import2.png"></p>
<p>If you want named variables to be imported as factors so it resembles SPSS more, use <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>.</p> <p>If you want named variables to be imported as factors so it resembles SPSS more, use <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>.</p>
<p>The difference is this:</p> <p>The difference is this:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">SPSS_data</a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a>SPSS_data</span>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="co"># # A tibble: 4,203 x 4</span></a> <span id="cb2-2"><a href="#cb2-2"></a><span class="co"># # A tibble: 4,203 x 4</span></span>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="co"># v001 sex status statusage</span></a> <span id="cb2-3"><a href="#cb2-3"></a><span class="co"># v001 sex status statusage</span></span>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co"># &lt;dbl&gt; &lt;dbl+lbl&gt; &lt;dbl+lbl&gt; &lt;dbl&gt;</span></a> <span id="cb2-4"><a href="#cb2-4"></a><span class="co"># &lt;dbl&gt; &lt;dbl+lbl&gt; &lt;dbl+lbl&gt; &lt;dbl&gt;</span></span>
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="co"># 1 10002 1 1 76.6</span></a> <span id="cb2-5"><a href="#cb2-5"></a><span class="co"># 1 10002 1 1 76.6</span></span>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="co"># 2 10004 0 1 59.1</span></a> <span id="cb2-6"><a href="#cb2-6"></a><span class="co"># 2 10004 0 1 59.1</span></span>
<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="co"># 3 10005 1 1 54.5</span></a> <span id="cb2-7"><a href="#cb2-7"></a><span class="co"># 3 10005 1 1 54.5</span></span>
<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="co"># 4 10006 1 1 54.1</span></a> <span id="cb2-8"><a href="#cb2-8"></a><span class="co"># 4 10006 1 1 54.1</span></span>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="co"># 5 10007 1 1 57.7</span></a> <span id="cb2-9"><a href="#cb2-9"></a><span class="co"># 5 10007 1 1 57.7</span></span>
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># 6 10008 1 1 62.8</span></a> <span id="cb2-10"><a href="#cb2-10"></a><span class="co"># 6 10008 1 1 62.8</span></span>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># 7 10010 0 1 63.7</span></a> <span id="cb2-11"><a href="#cb2-11"></a><span class="co"># 7 10010 0 1 63.7</span></span>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># 8 10011 1 1 73.1</span></a> <span id="cb2-12"><a href="#cb2-12"></a><span class="co"># 8 10011 1 1 73.1</span></span>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># 9 10017 1 1 56.7</span></a> <span id="cb2-13"><a href="#cb2-13"></a><span class="co"># 9 10017 1 1 56.7</span></span>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># 10 10018 0 1 66.6</span></a> <span id="cb2-14"><a href="#cb2-14"></a><span class="co"># 10 10018 0 1 66.6</span></span>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># # … with 4,193 more rows</span></a> <span id="cb2-15"><a href="#cb2-15"></a><span class="co"># # … with 4,193 more rows</span></span>
<a class="sourceLine" id="cb2-16" data-line-number="16"></a> <span id="cb2-16"><a href="#cb2-16"></a></span>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="kw">as_factor</span>(SPSS_data)</a> <span id="cb2-17"><a href="#cb2-17"></a><span class="kw">as_factor</span>(SPSS_data)</span>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># # A tibble: 4,203 x 4</span></a> <span id="cb2-18"><a href="#cb2-18"></a><span class="co"># # A tibble: 4,203 x 4</span></span>
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># v001 sex status statusage</span></a> <span id="cb2-19"><a href="#cb2-19"></a><span class="co"># v001 sex status statusage</span></span>
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># &lt;dbl&gt; &lt;fct&gt; &lt;fct&gt; &lt;dbl&gt;</span></a> <span id="cb2-20"><a href="#cb2-20"></a><span class="co"># &lt;dbl&gt; &lt;fct&gt; &lt;fct&gt; &lt;dbl&gt;</span></span>
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># 1 10002 Male alive 76.6</span></a> <span id="cb2-21"><a href="#cb2-21"></a><span class="co"># 1 10002 Male alive 76.6</span></span>
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># 2 10004 Female alive 59.1</span></a> <span id="cb2-22"><a href="#cb2-22"></a><span class="co"># 2 10004 Female alive 59.1</span></span>
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># 3 10005 Male alive 54.5</span></a> <span id="cb2-23"><a href="#cb2-23"></a><span class="co"># 3 10005 Male alive 54.5</span></span>
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># 4 10006 Male alive 54.1</span></a> <span id="cb2-24"><a href="#cb2-24"></a><span class="co"># 4 10006 Male alive 54.1</span></span>
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># 5 10007 Male alive 57.7</span></a> <span id="cb2-25"><a href="#cb2-25"></a><span class="co"># 5 10007 Male alive 57.7</span></span>
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># 6 10008 Male alive 62.8</span></a> <span id="cb2-26"><a href="#cb2-26"></a><span class="co"># 6 10008 Male alive 62.8</span></span>
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># 7 10010 Female alive 63.7</span></a> <span id="cb2-27"><a href="#cb2-27"></a><span class="co"># 7 10010 Female alive 63.7</span></span>
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># 8 10011 Male alive 73.1</span></a> <span id="cb2-28"><a href="#cb2-28"></a><span class="co"># 8 10011 Male alive 73.1</span></span>
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># 9 10017 Male alive 56.7</span></a> <span id="cb2-29"><a href="#cb2-29"></a><span class="co"># 9 10017 Male alive 56.7</span></span>
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># 10 10018 Female alive 66.6</span></a> <span id="cb2-30"><a href="#cb2-30"></a><span class="co"># 10 10018 Female alive 66.6</span></span>
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># # … with 4,193 more rows</span></a></code></pre></div> <span id="cb2-31"><a href="#cb2-31"></a><span class="co"># # … with 4,193 more rows</span></span></code></pre></div>
</div> </div>
<div id="base-r" class="section level3"> <div id="base-r" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#base-r" class="anchor"></a>Base R</h3> <a href="#base-r" class="anchor"></a>Base R</h3>
<p>To import data from SPSS, SAS or Stata, you can use the <a href="https://haven.tidyverse.org/">great <code>haven</code> package</a> yourself:</p> <p>To import data from SPSS, SAS or Stata, you can use the <a href="https://haven.tidyverse.org/">great <code>haven</code> package</a> yourself:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="co"># download and install the latest version:</span></a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a><span class="co"># download and install the latest version:</span></span>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"haven"</span>)</a> <span id="cb3-2"><a href="#cb3-2"></a><span class="kw"><a href="https://rdrr.io/r/utils/install.packages.html">install.packages</a></span>(<span class="st">"haven"</span>)</span>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co"># load the package you just installed:</span></a> <span id="cb3-3"><a href="#cb3-3"></a><span class="co"># load the package you just installed:</span></span>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(haven) </a></code></pre></div> <span id="cb3-4"><a href="#cb3-4"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(haven) </span></code></pre></div>
<p>You can now import files as follows:</p> <p>You can now import files as follows:</p>
<div id="spss" class="section level4"> <div id="spss" class="section level4">
<h4 class="hasAnchor"> <h4 class="hasAnchor">
<a href="#spss" class="anchor"></a>SPSS</h4> <a href="#spss" class="anchor"></a>SPSS</h4>
<p>To read files from SPSS into R:</p> <p>To read files from SPSS into R:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="co"># read any SPSS file based on file extension (best way):</span></a> <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a><span class="co"># read any SPSS file based on file extension (best way):</span></span>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_spss</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</a> <span id="cb4-2"><a href="#cb4-2"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_spss</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</span>
<a class="sourceLine" id="cb4-3" data-line-number="3"></a> <span id="cb4-3"><a href="#cb4-3"></a></span>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co"># read .sav or .zsav file:</span></a> <span id="cb4-4"><a href="#cb4-4"></a><span class="co"># read .sav or .zsav file:</span></span>
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_sav</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</a> <span id="cb4-5"><a href="#cb4-5"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_sav</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</span>
<a class="sourceLine" id="cb4-6" data-line-number="6"></a> <span id="cb4-6"><a href="#cb4-6"></a></span>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="co"># read .por file:</span></a> <span id="cb4-7"><a href="#cb4-7"></a><span class="co"># read .por file:</span></span>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_por</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</a></code></pre></div> <span id="cb4-8"><a href="#cb4-8"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">read_por</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</span></code></pre></div>
<p>Do not forget about <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>, as mentioned above.</p> <p>Do not forget about <code><a href="https://haven.tidyverse.org/reference/as_factor.html">as_factor()</a></code>, as mentioned above.</p>
<p>To export your R objects to the SPSS file format:</p> <p>To export your R objects to the SPSS file format:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="co"># save as .sav file:</span></a> <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="co"># save as .sav file:</span></span>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>)</a> <span id="cb5-2"><a href="#cb5-2"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>)</span>
<a class="sourceLine" id="cb5-3" data-line-number="3"></a> <span id="cb5-3"><a href="#cb5-3"></a></span>
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="co"># save as compressed .zsav file:</span></a> <span id="cb5-4"><a href="#cb5-4"></a><span class="co"># save as compressed .zsav file:</span></span>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>, <span class="dt">compress =</span> <span class="ot">TRUE</span>)</a></code></pre></div> <span id="cb5-5"><a href="#cb5-5"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_spss.html">write_sav</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>, <span class="dt">compress =</span> <span class="ot">TRUE</span>)</span></code></pre></div>
</div> </div>
<div id="sas" class="section level4"> <div id="sas" class="section level4">
<h4 class="hasAnchor"> <h4 class="hasAnchor">
<a href="#sas" class="anchor"></a>SAS</h4> <a href="#sas" class="anchor"></a>SAS</h4>
<p>To read files from SAS into R:</p> <p>To read files from SAS into R:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="co"># read .sas7bdat + .sas7bcat files:</span></a> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a><span class="co"># read .sas7bdat + .sas7bcat files:</span></span>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_sas.html">read_sas</a></span>(<span class="dt">data_file =</span> <span class="st">"path/to/file"</span>, <span class="dt">catalog_file =</span> <span class="ot">NULL</span>)</a> <span id="cb6-2"><a href="#cb6-2"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_sas.html">read_sas</a></span>(<span class="dt">data_file =</span> <span class="st">"path/to/file"</span>, <span class="dt">catalog_file =</span> <span class="ot">NULL</span>)</span>
<a class="sourceLine" id="cb6-3" data-line-number="3"></a> <span id="cb6-3"><a href="#cb6-3"></a></span>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># read SAS transport files (version 5 and version 8):</span></a> <span id="cb6-4"><a href="#cb6-4"></a><span class="co"># read SAS transport files (version 5 and version 8):</span></span>
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_xpt.html">read_xpt</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</a></code></pre></div> <span id="cb6-5"><a href="#cb6-5"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_xpt.html">read_xpt</a></span>(<span class="dt">file =</span> <span class="st">"path/to/file"</span>)</span></code></pre></div>
<p>To export your R objects to the SAS file format:</p> <p>To export your R objects to the SAS file format:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="co"># save as regular SAS file:</span></a> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a><span class="co"># save as regular SAS file:</span></span>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_sas.html">write_sas</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>)</a> <span id="cb7-2"><a href="#cb7-2"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_sas.html">write_sas</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>)</span>
<a class="sourceLine" id="cb7-3" data-line-number="3"></a> <span id="cb7-3"><a href="#cb7-3"></a></span>
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="co"># the SAS transport format is an open format </span></a> <span id="cb7-4"><a href="#cb7-4"></a><span class="co"># the SAS transport format is an open format </span></span>
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co"># (required for submission of the data to the FDA)</span></a> <span id="cb7-5"><a href="#cb7-5"></a><span class="co"># (required for submission of the data to the FDA)</span></span>
<a class="sourceLine" id="cb7-6" data-line-number="6"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_xpt.html">write_xpt</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>, <span class="dt">version =</span> <span class="dv">8</span>)</a></code></pre></div> <span id="cb7-6"><a href="#cb7-6"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_xpt.html">write_xpt</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"path/to/file"</span>, <span class="dt">version =</span> <span class="dv">8</span>)</span></code></pre></div>
</div> </div>
<div id="stata" class="section level4"> <div id="stata" class="section level4">
<h4 class="hasAnchor"> <h4 class="hasAnchor">
<a href="#stata" class="anchor"></a>Stata</h4> <a href="#stata" class="anchor"></a>Stata</h4>
<p>To read files from Stata into R:</p> <p>To read files from Stata into R:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="co"># read .dta file:</span></a> <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a><span class="co"># read .dta file:</span></span>
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_stata</a></span>(<span class="dt">file =</span> <span class="st">"/path/to/file"</span>)</a> <span id="cb8-2"><a href="#cb8-2"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_stata</a></span>(<span class="dt">file =</span> <span class="st">"/path/to/file"</span>)</span>
<a class="sourceLine" id="cb8-3" data-line-number="3"></a> <span id="cb8-3"><a href="#cb8-3"></a></span>
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="co"># works exactly the same:</span></a> <span id="cb8-4"><a href="#cb8-4"></a><span class="co"># works exactly the same:</span></span>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_dta</a></span>(<span class="dt">file =</span> <span class="st">"/path/to/file"</span>)</a></code></pre></div> <span id="cb8-5"><a href="#cb8-5"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">read_dta</a></span>(<span class="dt">file =</span> <span class="st">"/path/to/file"</span>)</span></code></pre></div>
<p>To export your R objects to the Stata file format:</p> <p>To export your R objects to the Stata file format:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="co"># save as .dta file, Stata version 14:</span></a> <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1"></a><span class="co"># save as .dta file, Stata version 14:</span></span>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co"># (supports Stata v8 until v15 at the time of writing)</span></a> <span id="cb9-2"><a href="#cb9-2"></a><span class="co"># (supports Stata v8 until v15 at the time of writing)</span></span>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">write_dta</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"/path/to/file"</span>, <span class="dt">version =</span> <span class="dv">14</span>)</a></code></pre></div> <span id="cb9-3"><a href="#cb9-3"></a><span class="kw"><a href="https://haven.tidyverse.org/reference/read_dta.html">write_dta</a></span>(<span class="dt">data =</span> yourdata, <span class="dt">path =</span> <span class="st">"/path/to/file"</span>, <span class="dt">version =</span> <span class="dv">14</span>)</span></code></pre></div>
</div> </div>
</div> </div>
</div> </div>
@ -414,20 +406,7 @@
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e', </body>
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html> </html>

View File

@ -16,9 +16,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous"> <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script><meta property="og:title" content="How to work with WHONET data"> <script src="../extra.js"></script><meta property="og:title" content="How to work with WHONET data">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png"> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
@ -41,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -166,13 +164,7 @@
</a> </a>
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div> </div>
</form>
</div>
<!--/.nav-collapse --> <!--/.nav-collapse -->
</div> </div>
<!--/.container --> <!--/.container -->
@ -187,7 +179,7 @@
<h1>How to work with WHONET data</h1> <h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">26 January 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div> <div class="hidden name"><code>WHONET.Rmd</code></div>
@ -201,36 +193,37 @@
<a href="#import-of-data" class="anchor"></a>Import of data</h3> <a href="#import-of-data" class="anchor"></a>Import of data</h3>
<p>This tutorial assumes you already imported the WHONET data with e.g. the <a href="https://readxl.tidyverse.org/"><code>readxl</code> package</a>. In RStudio, this can be done using the menu button Import Dataset in the tab Environment. Choose the option From Excel and select your exported file. Make sure date fields are imported correctly.</p> <p>This tutorial assumes you already imported the WHONET data with e.g. the <a href="https://readxl.tidyverse.org/"><code>readxl</code> package</a>. In RStudio, this can be done using the menu button Import Dataset in the tab Environment. Choose the option From Excel and select your exported file. Make sure date fields are imported correctly.</p>
<p>An example syntax could look like this:</p> <p>An example syntax could look like this:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(readxl)</a> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(readxl)</span>
<a class="sourceLine" id="cb1-2" data-line-number="2">data &lt;-<span class="st"> </span><span class="kw"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(<span class="dt">path =</span> <span class="st">"path/to/your/file.xlsx"</span>)</a></code></pre></div> <span id="cb1-2"><a href="#cb1-2"></a>data &lt;-<span class="st"> </span><span class="kw"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span>(<span class="dt">path =</span> <span class="st">"path/to/your/file.xlsx"</span>)</span></code></pre></div>
<p>This package comes with an <a href="https://msberends.gitlab.io/AMR/reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p> <p>This package comes with an <a href="https://msberends.gitlab.io/AMR/reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p>
</div> </div>
<div id="preparation" class="section level3"> <div id="preparation" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#preparation" class="anchor"></a>Preparation</h3> <a href="#preparation" class="anchor"></a>Preparation</h3>
<p>First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you dont know it yet, I suggest you read about it on their website: <a href="https://www.tidyverse.org/" class="uri">https://www.tidyverse.org/</a>.</p> <p>First, load the relevant packages if you did not yet did this. I use the tidyverse for all of my analyses. All of them. If you dont know it yet, I suggest you read about it on their website: <a href="https://www.tidyverse.org/" class="uri">https://www.tidyverse.org/</a>.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></span>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></a> <span id="cb2-2"><a href="#cb2-2"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></span>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR) <span class="co"># this package</span></a></code></pre></div> <span id="cb2-3"><a href="#cb2-3"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR) <span class="co"># this package</span></span></code></pre></div>
<p>We will have to transform some variables to simplify and automate the analysis:</p> <p>We will have to transform some variables to simplify and automate the analysis:</p>
<ul> <ul>
<li>Microorganisms should be transformed to our own microorganism IDs (called an <code>mo</code>) using <a href="https://msberends.gitlab.io/AMR/reference/catalogue_of_life">our Catalogue of Life reference data set</a>, which contains all ~70,000 microorganisms from the taxonomic kingdoms Bacteria, Fungi and Protozoa. We do the tranformation with <code><a href="../reference/as.mo.html">as.mo()</a></code>. This function also recognises almost all WHONET abbreviations of microorganisms.</li> <li>Microorganisms should be transformed to our own microorganism IDs (called an <code>mo</code>) using <a href="https://msberends.gitlab.io/AMR/reference/catalogue_of_life">our Catalogue of Life reference data set</a>, which contains all ~70,000 microorganisms from the taxonomic kingdoms Bacteria, Fungi and Protozoa. We do the tranformation with <code><a href="../reference/as.mo.html">as.mo()</a></code>. This function also recognises almost all WHONET abbreviations of microorganisms.</li>
<li>Antimicrobial results or interpretations have to be clean and valid. In other words, they should only contain values <code>"S"</code>, <code>"I"</code> or <code>"R"</code>. That is exactly where the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function is for.</li> <li>Antimicrobial results or interpretations have to be clean and valid. In other words, they should only contain values <code>"S"</code>, <code>"I"</code> or <code>"R"</code>. That is exactly where the <code><a href="../reference/as.rsi.html">as.rsi()</a></code> function is for.</li>
</ul> </ul>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="co"># transform variables</span></a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a><span class="co"># transform variables</span></span>
<a class="sourceLine" id="cb3-2" data-line-number="2">data &lt;-<span class="st"> </span>WHONET <span class="op">%&gt;%</span></a> <span id="cb3-2"><a href="#cb3-2"></a>data &lt;-<span class="st"> </span>WHONET <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="st"> </span><span class="co"># get microbial ID based on given organism</span></a> <span id="cb3-3"><a href="#cb3-3"></a><span class="st"> </span><span class="co"># get microbial ID based on given organism</span></span>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">mo =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(Organism)) <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb3-4"><a href="#cb3-4"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">mo =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(Organism)) <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="st"> </span><span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span></a> <span id="cb3-5"><a href="#cb3-5"></a><span class="st"> </span><span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span></span>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMP_ND10<span class="op">:</span>CIP_EE), as.rsi)</a></code></pre></div> <span id="cb3-6"><a href="#cb3-6"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMP_ND10<span class="op">:</span>CIP_EE), as.rsi)</span></code></pre></div>
<p>No errors or warnings, so all values are transformed succesfully.</p> <p>No errors or warnings, so all values are transformed succesfully.</p>
<p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. It gets automatically installed with the <code>AMR</code> package. For its <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function to create frequency tables, you dont even need to load it yourself as it is available through the <code>AMR</code> package as well.</p> <p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. It gets automatically installed with the <code>AMR</code> package. For its <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function to create frequency tables, you dont even need to load it yourself as it is available through the <code>AMR</code> package as well.</p>
<p>So lets check our data, with a couple of frequency tables:</p> <p>So lets check our data, with a couple of frequency tables:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="co"># our newly created `mo` variable, put in the mo_name() function</span></a> <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a><span class="co"># our newly created `mo` variable, put in the mo_name() function</span></span>
<a class="sourceLine" id="cb4-2" data-line-number="2">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(mo), <span class="dt">nmax =</span> <span class="dv">10</span>)</a></code></pre></div> <span id="cb4-2"><a href="#cb4-2"></a>data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(mo), <span class="dt">nmax =</span> <span class="dv">10</span>)</span></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: character<br> <p>Class: character<br>
Length: 500 (of which NA: 0 = 0%)<br> Length: 500<br>
Available: 500 (100%, NA: 0 = 0%)<br>
Unique: 39</p> Unique: 39</p>
<p>Shortest: 11<br> <p>Shortest: 11<br>
Longest: 40</p> Longest: 40</p>
@ -327,13 +320,14 @@ Longest: 40</p>
</tbody> </tbody>
</table> </table>
<p>(omitted 29 entries, n = 57 [11.40%])</p> <p>(omitted 29 entries, n = 57 [11.40%])</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="co"># our transformed antibiotic columns</span></a> <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="co"># our transformed antibiotic columns</span></span>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a> <span id="cb5-2"><a href="#cb5-2"></a><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></span>
<a class="sourceLine" id="cb5-3" data-line-number="3">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div> <span id="cb5-3"><a href="#cb5-3"></a>data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(AMC_ND2)</span></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered &gt; rsi (numeric)<br> <p>Class: factor &gt; ordered &gt; rsi (numeric)<br>
Length: 500 (of which NA: 19 = 3.8%)<br> Length: 500<br>
Levels: 3: S &lt; I &lt; R<br> Levels: 3: S &lt; I &lt; R<br>
Available: 481 (96.2%, NA: 19 = 3.8%)<br>
Unique: 3</p> Unique: 3</p>
<p>%SI: 78.6%</p> <p>%SI: 78.6%</p>
<table class="table"> <table class="table">
@ -377,10 +371,10 @@ Unique: 3</p>
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#a-first-glimpse-at-results" class="anchor"></a>A first glimpse at results</h3> <a href="#a-first-glimpse-at-results" class="anchor"></a>A first glimpse at results</h3>
<p>An easy <code>ggplot</code> will already give a lot of information, using the included <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> function:</p> <p>An easy <code>ggplot</code> will already give a lot of information, using the included <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> function:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">data <span class="op">%&gt;%</span></a> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a>data <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(Country) <span class="op">%&gt;%</span></a> <span id="cb6-2"><a href="#cb6-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(Country) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(Country, AMP_ND2, AMC_ED20, CAZ_ED10, CIP_ED5) <span class="op">%&gt;%</span></a> <span id="cb6-3"><a href="#cb6-3"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(Country, AMP_ND2, AMC_ED20, CAZ_ED10, CIP_ED5) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(<span class="dt">translate_ab =</span> <span class="st">'ab'</span>, <span class="dt">facet =</span> <span class="st">"Country"</span>, <span class="dt">datalabels =</span> <span class="ot">FALSE</span>)</a></code></pre></div> <span id="cb6-4"><a href="#cb6-4"></a><span class="st"> </span><span class="kw"><a href="../reference/ggplot_rsi.html">ggplot_rsi</a></span>(<span class="dt">translate_ab =</span> <span class="st">'ab'</span>, <span class="dt">facet =</span> <span class="st">"Country"</span>, <span class="dt">datalabels =</span> <span class="ot">FALSE</span>)</span></code></pre></div>
<p><img src="WHONET_files/figure-html/unnamed-chunk-7-1.png" width="720"></p> <p><img src="WHONET_files/figure-html/unnamed-chunk-7-1.png" width="720"></p>
</div> </div>
</div> </div>
@ -405,20 +399,7 @@ Unique: 3</p>
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e', </body>
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html> </html>

View File

@ -16,9 +16,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous"> <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script><meta property="og:title" content="Benchmarks"> <script src="../extra.js"></script><meta property="og:title" content="Benchmarks">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png"> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
@ -41,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9021</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -166,13 +164,7 @@
</a> </a>
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div> </div>
</form>
</div>
<!--/.nav-collapse --> <!--/.nav-collapse -->
</div> </div>
<!--/.container --> <!--/.container -->
@ -187,7 +179,7 @@
<h1>Benchmarks</h1> <h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 February 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div> <div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -198,68 +190,68 @@
<p>One of the most important features of this package is the complete microbial taxonomic database, supplied by the <a href="http://catalogueoflife.org">Catalogue of Life</a>. We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.</p> <p>One of the most important features of this package is the complete microbial taxonomic database, supplied by the <a href="http://catalogueoflife.org">Catalogue of Life</a>. We created a function <code><a href="../reference/as.mo.html">as.mo()</a></code> that transforms any user input value to a valid microbial ID by using intelligent rules combined with the taxonomic tree of Catalogue of Life.</p>
<p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function. Its function <code><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark()</a></code> runs different input expressions independently of each other and measures their time-to-result.</p> <p>Using the <code>microbenchmark</code> package, we can review the calculation performance of this function. Its function <code><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark()</a></code> runs different input expressions independently of each other and measures their time-to-result.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(microbenchmark)</a> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(microbenchmark)</span>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</a></code></pre></div> <span id="cb1-2"><a href="#cb1-2"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</span></code></pre></div>
<p>In the next test, we try to coerce different input values into the microbial code of <em>Staphylococcus aureus</em>. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.</p> <p>In the next test, we try to coerce different input values into the microbial code of <em>Staphylococcus aureus</em>. Coercion is a computational process of forcing output based on an input. For microorganism names, coercing user input to taxonomically valid microorganism names is crucial to ensure correct interpretation and to enable grouping based on taxonomic properties.</p>
<p>The actual result is the same every time: it returns its microorganism code <code>B_STPHY_AURS</code> (<em>B</em> stands for <em>Bacteria</em>, the taxonomic kingdom).</p> <p>The actual result is the same every time: it returns its microorganism code <code>B_STPHY_AURS</code> (<em>B</em> stands for <em>Bacteria</em>, the taxonomic kingdom).</p>
<p>But the calculation time differs a lot:</p> <p>But the calculation time differs a lot:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">S.aureus &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(</a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a>S.aureus &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(</span>
<a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"sau"</span>), <span class="co"># WHONET code</span></a> <span id="cb2-2"><a href="#cb2-2"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"sau"</span>), <span class="co"># WHONET code</span></span>
<a class="sourceLine" id="cb2-3" data-line-number="3"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"stau"</span>),</a> <span id="cb2-3"><a href="#cb2-3"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"stau"</span>),</span>
<a class="sourceLine" id="cb2-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"STAU"</span>),</a> <span id="cb2-4"><a href="#cb2-4"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"STAU"</span>),</span>
<a class="sourceLine" id="cb2-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"staaur"</span>),</a> <span id="cb2-5"><a href="#cb2-5"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"staaur"</span>),</span>
<a class="sourceLine" id="cb2-6" data-line-number="6"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"STAAUR"</span>),</a> <span id="cb2-6"><a href="#cb2-6"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"STAAUR"</span>),</span>
<a class="sourceLine" id="cb2-7" data-line-number="7"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. aureus"</span>),</a> <span id="cb2-7"><a href="#cb2-7"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. aureus"</span>),</span>
<a class="sourceLine" id="cb2-8" data-line-number="8"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S aureus"</span>),</a> <span id="cb2-8"><a href="#cb2-8"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S aureus"</span>),</span>
<a class="sourceLine" id="cb2-9" data-line-number="9"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Staphylococcus aureus"</span>), <span class="co"># official taxonomic name</span></a> <span id="cb2-9"><a href="#cb2-9"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Staphylococcus aureus"</span>), <span class="co"># official taxonomic name</span></span>
<a class="sourceLine" id="cb2-10" data-line-number="10"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Staphylococcus aureus (MRSA)"</span>), <span class="co"># additional text</span></a> <span id="cb2-10"><a href="#cb2-10"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Staphylococcus aureus (MRSA)"</span>), <span class="co"># additional text</span></span>
<a class="sourceLine" id="cb2-11" data-line-number="11"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Sthafilokkockus aaureuz"</span>), <span class="co"># incorrect spelling</span></a> <span id="cb2-11"><a href="#cb2-11"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Sthafilokkockus aaureuz"</span>), <span class="co"># incorrect spelling</span></span>
<a class="sourceLine" id="cb2-12" data-line-number="12"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>), <span class="co"># Methicillin Resistant S. aureus</span></a> <span id="cb2-12"><a href="#cb2-12"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>), <span class="co"># Methicillin Resistant S. aureus</span></span>
<a class="sourceLine" id="cb2-13" data-line-number="13"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"VISA"</span>), <span class="co"># Vancomycin Intermediate S. aureus</span></a> <span id="cb2-13"><a href="#cb2-13"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"VISA"</span>), <span class="co"># Vancomycin Intermediate S. aureus</span></span>
<a class="sourceLine" id="cb2-14" data-line-number="14"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"VRSA"</span>), <span class="co"># Vancomycin Resistant S. aureus</span></a> <span id="cb2-14"><a href="#cb2-14"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"VRSA"</span>), <span class="co"># Vancomycin Resistant S. aureus</span></span>
<a class="sourceLine" id="cb2-15" data-line-number="15"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="dv">22242419</span>), <span class="co"># Catalogue of Life ID</span></a> <span id="cb2-15"><a href="#cb2-15"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="dv">22242419</span>), <span class="co"># Catalogue of Life ID</span></span>
<a class="sourceLine" id="cb2-16" data-line-number="16"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <span id="cb2-16"><a href="#cb2-16"></a> <span class="dt">times =</span> <span class="dv">10</span>)</span>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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> <span id="cb2-17"><a href="#cb2-17"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">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>)</span>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># Unit: milliseconds</span></a> <span id="cb2-18"><a href="#cb2-18"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="co"># expr min lq mean median uq max neval</span></a> <span id="cb2-19"><a href="#cb2-19"></a><span class="co"># expr min lq mean median uq max neval</span></span>
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="co"># as.mo("sau") 8.0 8.2 11.0 8.4 8.6 34 10</span></a> <span id="cb2-20"><a href="#cb2-20"></a><span class="co"># as.mo("sau") 8.2 8.5 12.0 9.1 9.5 34 10</span></span>
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="co"># as.mo("stau") 37.0 37.0 41.0 38.0 40.0 65 10</span></a> <span id="cb2-21"><a href="#cb2-21"></a><span class="co"># as.mo("stau") 36.0 37.0 50.0 40.0 65.0 82 10</span></span>
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="co"># as.mo("STAU") 37.0 38.0 47.0 41.0 62.0 69 10</span></a> <span id="cb2-22"><a href="#cb2-22"></a><span class="co"># as.mo("STAU") 38.0 41.0 49.0 41.0 64.0 72 10</span></span>
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="co"># as.mo("staaur") 8.1 8.2 16.0 8.4 8.8 57 10</span></a> <span id="cb2-23"><a href="#cb2-23"></a><span class="co"># as.mo("staaur") 8.4 8.9 9.2 9.2 9.3 10 10</span></span>
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="co"># as.mo("STAAUR") 8.1 8.3 11.0 8.5 8.9 34 10</span></a> <span id="cb2-24"><a href="#cb2-24"></a><span class="co"># as.mo("STAAUR") 8.4 8.7 13.0 9.4 9.5 43 10</span></span>
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="co"># as.mo("S. aureus") 14.0 14.0 21.0 14.0 36.0 37 10</span></a> <span id="cb2-25"><a href="#cb2-25"></a><span class="co"># as.mo("S. aureus") 14.0 15.0 30.0 37.0 40.0 44 10</span></span>
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="co"># as.mo("S aureus") 13.0 14.0 20.0 15.0 16.0 47 10</span></a> <span id="cb2-26"><a href="#cb2-26"></a><span class="co"># as.mo("S aureus") 14.0 15.0 43.0 15.0 37.0 250 10</span></span>
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="co"># as.mo("Staphylococcus aureus") 4.7 4.8 8.6 4.9 6.2 39 10</span></a> <span id="cb2-27"><a href="#cb2-27"></a><span class="co"># as.mo("Staphylococcus aureus") 4.7 5.0 7.4 5.1 5.5 28 10</span></span>
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 640.0 650.0 680.0 660.0 680.0 790 10</span></a> <span id="cb2-28"><a href="#cb2-28"></a><span class="co"># as.mo("Staphylococcus aureus (MRSA)") 660.0 690.0 720.0 730.0 730.0 790 10</span></span>
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="co"># as.mo("Sthafilokkockus aaureuz") 330.0 350.0 390.0 390.0 430.0 500 10</span></a> <span id="cb2-29"><a href="#cb2-29"></a><span class="co"># as.mo("Sthafilokkockus aaureuz") 350.0 380.0 420.0 400.0 440.0 520 10</span></span>
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="co"># as.mo("MRSA") 8.0 8.5 17.0 9.0 33.0 43 10</span></a> <span id="cb2-30"><a href="#cb2-30"></a><span class="co"># as.mo("MRSA") 8.1 8.5 12.0 9.1 9.3 38 10</span></span>
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="co"># as.mo("VISA") 24.0 24.0 36.0 30.0 47.0 56 10</span></a> <span id="cb2-31"><a href="#cb2-31"></a><span class="co"># as.mo("VISA") 24.0 26.0 35.0 28.0 46.0 52 10</span></span>
<a class="sourceLine" id="cb2-32" data-line-number="32"><span class="co"># as.mo("VRSA") 24.0 25.0 60.0 36.0 50.0 270 10</span></a> <span id="cb2-32"><a href="#cb2-32"></a><span class="co"># as.mo("VRSA") 24.0 26.0 35.0 29.0 47.0 57 10</span></span>
<a class="sourceLine" id="cb2-33" data-line-number="33"><span class="co"># as.mo(22242419) 120.0 120.0 130.0 130.0 140.0 150 10</span></a></code></pre></div> <span id="cb2-33"><a href="#cb2-33"></a><span class="co"># as.mo(22242419) 130.0 130.0 150.0 140.0 150.0 240 10</span></span></code></pre></div>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="562.5"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-4-1.png" width="562.5"></p>
<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.</p> <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.</p>
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside of this is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Methanosarcina semesiae</em> (<code>B_MTHNSR_SEMS</code>), a bug probably never found before in humans:</p> <p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside of this is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Methanosarcina semesiae</em> (<code>B_MTHNSR_SEMS</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" data-line-number="1">M.semesiae &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"metsem"</span>),</a> <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a>M.semesiae &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"metsem"</span>),</span>
<a class="sourceLine" id="cb3-2" data-line-number="2"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"METSEM"</span>),</a> <span id="cb3-2"><a href="#cb3-2"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"METSEM"</span>),</span>
<a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a> <span id="cb3-3"><a href="#cb3-3"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</span>
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</a> <span id="cb3-4"><a href="#cb3-4"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"M. semesiae"</span>),</span>
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Methanosarcina semesiae"</span>),</a> <span id="cb3-5"><a href="#cb3-5"></a> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"Methanosarcina semesiae"</span>),</span>
<a class="sourceLine" id="cb3-6" data-line-number="6"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <span id="cb3-6"><a href="#cb3-6"></a> <span class="dt">times =</span> <span class="dv">10</span>)</span>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(M.semesiae, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a> <span id="cb3-7"><a href="#cb3-7"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">print</a></span>(M.semesiae, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</span>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a> <span id="cb3-8"><a href="#cb3-8"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq</span></a> <span id="cb3-9"><a href="#cb3-9"></a><span class="co"># expr min lq mean median uq</span></span>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("metsem") 1422.000 1474.000 1511.000 1515.000 1544.00</span></a> <span id="cb3-10"><a href="#cb3-10"></a><span class="co"># as.mo("metsem") 1497.000 1536.000 1604.00 1575.00 1693.000</span></span>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("METSEM") 1381.000 1446.000 1457.000 1458.000 1477.00</span></a> <span id="cb3-11"><a href="#cb3-11"></a><span class="co"># as.mo("METSEM") 1472.000 1510.000 1563.00 1563.00 1615.000</span></span>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("M. semesiae") 14.390 14.520 18.050 15.000 17.64</span></a> <span id="cb3-12"><a href="#cb3-12"></a><span class="co"># as.mo("M. semesiae") 14.520 14.760 22.18 15.39 36.430</span></span>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("M. semesiae") 14.330 14.570 17.690 14.740 15.14</span></a> <span id="cb3-13"><a href="#cb3-13"></a><span class="co"># as.mo("M. semesiae") 14.310 14.630 19.94 15.18 16.080</span></span>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Methanosarcina semesiae") 5.261 5.342 7.848 5.459 5.63</span></a> <span id="cb3-14"><a href="#cb3-14"></a><span class="co"># as.mo("Methanosarcina semesiae") 5.376 5.482 8.41 5.81 5.911</span></span>
<a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># max neval</span></a> <span id="cb3-15"><a href="#cb3-15"></a><span class="co"># max neval</span></span>
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="co"># 1617.00 10</span></a> <span id="cb3-16"><a href="#cb3-16"></a><span class="co"># 1709.00 10</span></span>
<a class="sourceLine" id="cb3-17" data-line-number="17"><span class="co"># 1520.00 10</span></a> <span id="cb3-17"><a href="#cb3-17"></a><span class="co"># 1641.00 10</span></span>
<a class="sourceLine" id="cb3-18" data-line-number="18"><span class="co"># 39.73 10</span></a> <span id="cb3-18"><a href="#cb3-18"></a><span class="co"># 40.57 10</span></span>
<a class="sourceLine" id="cb3-19" data-line-number="19"><span class="co"># 39.72 10</span></a> <span id="cb3-19"><a href="#cb3-19"></a><span class="co"># 40.27 10</span></span>
<a class="sourceLine" id="cb3-20" data-line-number="20"><span class="co"># 29.36 10</span></a></code></pre></div> <span id="cb3-20"><a href="#cb3-20"></a><span class="co"># 32.27 10</span></span></code></pre></div>
<p>That takes 5.6 times as much time on average. 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>Methanosarcina semesiae</em>) are always very fast and only take some thousands of seconds to coerce - they are the most probable input from most data sets.</p> <p>That takes 5.7 times as much time on average. 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>Methanosarcina semesiae</em>) are always very fast and only take some thousands of seconds to coerce - they 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>Methanosarcina semesiae</em> (which is uncommon):</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>Methanosarcina semesiae</em> (which is uncommon):</p>
<p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="900"></p> <p><img src="benchmarks_files/figure-html/unnamed-chunk-6-1.png" width="900"></p>
<p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p> <p>Uncommon microorganisms take a lot more time than common microorganisms. To relieve this pitfall and further improve performance, two important calculations take almost no time at all: <strong>repetitive results</strong> and <strong>already precalculated results</strong>.</p>
@ -267,103 +259,103 @@
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#repetitive-results" class="anchor"></a>Repetitive results</h3> <a href="#repetitive-results" class="anchor"></a>Repetitive results</h3>
<p>Repetitive results are unique values that are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_name()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p> <p>Repetitive results are unique values that are present more than once. Unique values will only be calculated once by <code><a href="../reference/as.mo.html">as.mo()</a></code>. We will use <code><a href="../reference/mo_property.html">mo_name()</a></code> for this test - a helper function that returns the full microbial name (genus, species and possibly subspecies) which uses <code><a href="../reference/as.mo.html">as.mo()</a></code> internally.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a> <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</span>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co"># take all MO codes from the example_isolates data set</span></a> <span id="cb4-2"><a href="#cb4-2"></a><span class="co"># take all MO codes from the example_isolates data set</span></span>
<a class="sourceLine" id="cb4-3" data-line-number="3">x &lt;-<span class="st"> </span>example_isolates<span class="op">$</span>mo <span class="op">%&gt;%</span></a> <span id="cb4-3"><a href="#cb4-3"></a>x &lt;-<span class="st"> </span>example_isolates<span class="op">$</span>mo <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="st"> </span><span class="co"># keep only the unique ones</span></a> <span id="cb4-4"><a href="#cb4-4"></a><span class="st"> </span><span class="co"># keep only the unique ones</span></span>
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/unique.html">unique</a></span>() <span class="op">%&gt;%</span></a> <span id="cb4-5"><a href="#cb4-5"></a><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/unique.html">unique</a></span>() <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="st"> </span><span class="co"># pick 50 of them at random</span></a> <span id="cb4-6"><a href="#cb4-6"></a><span class="st"> </span><span class="co"># pick 50 of them at random</span></span>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></a> <span id="cb4-7"><a href="#cb4-7"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="dv">50</span>) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="st"> </span><span class="co"># paste that 10,000 times</span></a> <span id="cb4-8"><a href="#cb4-8"></a><span class="st"> </span><span class="co"># paste that 10,000 times</span></span>
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></a> <span id="cb4-9"><a href="#cb4-9"></a><span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/rep.html">rep</a></span>(<span class="dv">10000</span>) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb4-10" data-line-number="10"><span class="st"> </span><span class="co"># scramble it</span></a> <span id="cb4-10"><a href="#cb4-10"></a><span class="st"> </span><span class="co"># scramble it</span></span>
<a class="sourceLine" id="cb4-11" data-line-number="11"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</a> <span id="cb4-11"><a href="#cb4-11"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>()</span>
<a class="sourceLine" id="cb4-12" data-line-number="12"> </a> <span id="cb4-12"><a href="#cb4-12"></a> </span>
<a class="sourceLine" id="cb4-13" data-line-number="13"><span class="co"># got indeed 50 times 10,000 = half a million?</span></a> <span id="cb4-13"><a href="#cb4-13"></a><span class="co"># got indeed 50 times 10,000 = half a million?</span></span>
<a class="sourceLine" id="cb4-14" data-line-number="14"><span class="kw"><a href="https://rdrr.io/r/base/length.html">length</a></span>(x)</a> <span id="cb4-14"><a href="#cb4-14"></a><span class="kw"><a href="https://rdrr.io/r/base/length.html">length</a></span>(x)</span>
<a class="sourceLine" id="cb4-15" data-line-number="15"><span class="co"># [1] 500000</span></a> <span id="cb4-15"><a href="#cb4-15"></a><span class="co"># [1] 500000</span></span>
<a class="sourceLine" id="cb4-16" data-line-number="16"></a> <span id="cb4-16"><a href="#cb4-16"></a></span>
<a class="sourceLine" id="cb4-17" data-line-number="17"><span class="co"># and how many unique values do we have?</span></a> <span id="cb4-17"><a href="#cb4-17"></a><span class="co"># and how many unique values do we have?</span></span>
<a class="sourceLine" id="cb4-18" data-line-number="18"><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</a> <span id="cb4-18"><a href="#cb4-18"></a><span class="kw"><a href="https://dplyr.tidyverse.org/reference/n_distinct.html">n_distinct</a></span>(x)</span>
<a class="sourceLine" id="cb4-19" data-line-number="19"><span class="co"># [1] 50</span></a> <span id="cb4-19"><a href="#cb4-19"></a><span class="co"># [1] 50</span></span>
<a class="sourceLine" id="cb4-20" data-line-number="20"></a> <span id="cb4-20"><a href="#cb4-20"></a></span>
<a class="sourceLine" id="cb4-21" data-line-number="21"><span class="co"># now let's see:</span></a> <span id="cb4-21"><a href="#cb4-21"></a><span class="co"># now let's see:</span></span>
<a class="sourceLine" id="cb4-22" data-line-number="22">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(x),</a> <span id="cb4-22"><a href="#cb4-22"></a>run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(x),</span>
<a class="sourceLine" id="cb4-23" data-line-number="23"> <span class="dt">times =</span> <span class="dv">100</span>)</a> <span id="cb4-23"><a href="#cb4-23"></a> <span class="dt">times =</span> <span class="dv">100</span>)</span>
<a class="sourceLine" id="cb4-24" data-line-number="24"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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> <span id="cb4-24"><a href="#cb4-24"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">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>)</span>
<a class="sourceLine" id="cb4-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a> <span id="cb4-25"><a href="#cb4-25"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb4-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a> <span id="cb4-26"><a href="#cb4-26"></a><span class="co"># expr min lq mean median uq max neval</span></span>
<a class="sourceLine" id="cb4-27" data-line-number="27"><span class="co"># mo_name(x) 566 598 628 621 645 782 100</span></a></code></pre></div> <span id="cb4-27"><a href="#cb4-27"></a><span class="co"># mo_name(x) 568 614 651 634 657 1170 100</span></span></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.62 seconds (620 ms). You only lose time on your unique input values.</p> <p>So transforming 500,000 values (!!) of 50 unique values only takes 0.63 seconds (634 ms). You only lose time on your unique input values.</p>
</div> </div>
<div id="precalculated-results" class="section level3"> <div id="precalculated-results" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#precalculated-results" class="anchor"></a>Precalculated results</h3> <a href="#precalculated-results" class="anchor"></a>Precalculated results</h3>
<p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_name()</a></code>, it almost doesnt take any time at all (see C below):</p> <p>What about precalculated results? If the input is an already precalculated result of a helper function like <code><a href="../reference/mo_property.html">mo_name()</a></code>, it almost doesnt take any time at all (see C below):</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"B_STPHY_AURS"</span>),</a> <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a>run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"B_STPHY_AURS"</span>),</span>
<a class="sourceLine" id="cb5-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"S. aureus"</span>),</a> <span id="cb5-2"><a href="#cb5-2"></a> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"S. aureus"</span>),</span>
<a class="sourceLine" id="cb5-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a> <span id="cb5-3"><a href="#cb5-3"></a> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</span>
<a class="sourceLine" id="cb5-4" data-line-number="4"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <span id="cb5-4"><a href="#cb5-4"></a> <span class="dt">times =</span> <span class="dv">10</span>)</span>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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> <span id="cb5-5"><a href="#cb5-5"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">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>)</span>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a> <span id="cb5-6"><a href="#cb5-6"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a> <span id="cb5-7"><a href="#cb5-7"></a><span class="co"># expr min lq mean median uq max neval</span></span>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="co"># A 6.120 6.540 7.44 6.900 8.830 9.12 10</span></a> <span id="cb5-8"><a href="#cb5-8"></a><span class="co"># A 6.630 6.790 7.330 7.230 7.690 8.39 10</span></span>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="co"># B 13.600 13.800 14.50 14.200 15.000 16.30 10</span></a> <span id="cb5-9"><a href="#cb5-9"></a><span class="co"># B 13.900 14.300 19.000 14.700 17.000 53.00 10</span></span>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="co"># C 0.841 0.859 3.82 0.876 0.917 30.30 10</span></a></code></pre></div> <span id="cb5-10"><a href="#cb5-10"></a><span class="co"># C 0.847 0.875 0.947 0.901 0.977 1.16 10</span></span></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0009 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> <p>So going from <code><a href="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0009 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="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">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> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a>run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">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>),</span>
<a class="sourceLine" id="cb6-2" data-line-number="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> <span id="cb6-2"><a href="#cb6-2"></a> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</span>
<a class="sourceLine" id="cb6-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a> <span id="cb6-3"><a href="#cb6-3"></a> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"Staphylococcus aureus"</span>),</span>
<a class="sourceLine" id="cb6-4" data-line-number="4"> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</a> <span id="cb6-4"><a href="#cb6-4"></a> <span class="dt">D =</span> <span class="kw"><a href="../reference/mo_property.html">mo_family</a></span>(<span class="st">"Staphylococcaceae"</span>),</span>
<a class="sourceLine" id="cb6-5" data-line-number="5"> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</a> <span id="cb6-5"><a href="#cb6-5"></a> <span class="dt">E =</span> <span class="kw"><a href="../reference/mo_property.html">mo_order</a></span>(<span class="st">"Bacillales"</span>),</span>
<a class="sourceLine" id="cb6-6" data-line-number="6"> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</a> <span id="cb6-6"><a href="#cb6-6"></a> <span class="dt">F =</span> <span class="kw"><a href="../reference/mo_property.html">mo_class</a></span>(<span class="st">"Bacilli"</span>),</span>
<a class="sourceLine" id="cb6-7" data-line-number="7"> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</a> <span id="cb6-7"><a href="#cb6-7"></a> <span class="dt">G =</span> <span class="kw"><a href="../reference/mo_property.html">mo_phylum</a></span>(<span class="st">"Firmicutes"</span>),</span>
<a class="sourceLine" id="cb6-8" data-line-number="8"> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</a> <span id="cb6-8"><a href="#cb6-8"></a> <span class="dt">H =</span> <span class="kw"><a href="../reference/mo_property.html">mo_kingdom</a></span>(<span class="st">"Bacteria"</span>),</span>
<a class="sourceLine" id="cb6-9" data-line-number="9"> <span class="dt">times =</span> <span class="dv">10</span>)</a> <span id="cb6-9"><a href="#cb6-9"></a> <span class="dt">times =</span> <span class="dv">10</span>)</span>
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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> <span id="cb6-10"><a href="#cb6-10"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">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>)</span>
<a class="sourceLine" id="cb6-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a> <span id="cb6-11"><a href="#cb6-11"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb6-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a> <span id="cb6-12"><a href="#cb6-12"></a><span class="co"># expr min lq mean median uq max neval</span></span>
<a class="sourceLine" id="cb6-13" data-line-number="13"><span class="co"># A 0.517 0.522 0.570 0.540 0.575 0.756 10</span></a> <span id="cb6-13"><a href="#cb6-13"></a><span class="co"># A 0.476 0.485 0.501 0.498 0.504 0.554 10</span></span>
<a class="sourceLine" id="cb6-14" data-line-number="14"><span class="co"># B 0.536 0.550 0.584 0.559 0.579 0.801 10</span></a> <span id="cb6-14"><a href="#cb6-14"></a><span class="co"># B 0.515 0.521 0.548 0.545 0.553 0.614 10</span></span>
<a class="sourceLine" id="cb6-15" data-line-number="15"><span class="co"># C 0.696 0.776 0.804 0.828 0.841 0.908 10</span></a> <span id="cb6-15"><a href="#cb6-15"></a><span class="co"># C 0.710 0.791 0.870 0.842 0.855 1.330 10</span></span>
<a class="sourceLine" id="cb6-16" data-line-number="16"><span class="co"># D 0.531 0.552 0.597 0.576 0.616 0.784 10</span></a> <span id="cb6-16"><a href="#cb6-16"></a><span class="co"># D 0.491 0.524 0.539 0.535 0.546 0.613 10</span></span>
<a class="sourceLine" id="cb6-17" data-line-number="17"><span class="co"># E 0.520 0.529 0.549 0.534 0.569 0.626 10</span></a> <span id="cb6-17"><a href="#cb6-17"></a><span class="co"># E 0.488 0.500 0.583 0.541 0.635 0.830 10</span></span>
<a class="sourceLine" id="cb6-18" data-line-number="18"><span class="co"># F 0.483 0.491 0.519 0.517 0.521 0.580 10</span></a> <span id="cb6-18"><a href="#cb6-18"></a><span class="co"># F 0.477 0.488 0.509 0.495 0.519 0.569 10</span></span>
<a class="sourceLine" id="cb6-19" data-line-number="19"><span class="co"># G 0.509 0.514 0.545 0.520 0.537 0.763 10</span></a> <span id="cb6-19"><a href="#cb6-19"></a><span class="co"># G 0.473 0.490 0.507 0.498 0.534 0.547 10</span></span>
<a class="sourceLine" id="cb6-20" data-line-number="20"><span class="co"># H 0.464 0.514 0.555 0.542 0.593 0.698 10</span></a></code></pre></div> <span id="cb6-20"><a href="#cb6-20"></a><span class="co"># H 0.477 0.486 0.500 0.494 0.509 0.561 10</span></span></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> anyway, 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> <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> anyway, 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>
<div id="results-in-other-languages" class="section level3"> <div id="results-in-other-languages" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3> <a href="#results-in-other-languages" class="anchor"></a>Results in other languages</h3>
<p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost doest take extra time:</p> <p>When the system language is non-English and supported by this <code>AMR</code> package, some functions will have a translated result. This almost doest take extra time:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_name("CoNS") on an English system</span></a> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>) <span class="co"># or just mo_name("CoNS") on an English system</span></span>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># [1] "Coagulase-negative Staphylococcus (CoNS)"</span></a> <span id="cb7-2"><a href="#cb7-2"></a><span class="co"># [1] "Coagulase-negative Staphylococcus (CoNS)"</span></span>
<a class="sourceLine" id="cb7-3" data-line-number="3"></a> <span id="cb7-3"><a href="#cb7-3"></a></span>
<a class="sourceLine" id="cb7-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_name("CoNS") on a Spanish system</span></a> <span id="cb7-4"><a href="#cb7-4"></a><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># or just mo_name("CoNS") on a Spanish system</span></span>
<a class="sourceLine" id="cb7-5" data-line-number="5"><span class="co"># [1] "Staphylococcus coagulasa negativo (SCN)"</span></a> <span id="cb7-5"><a href="#cb7-5"></a><span class="co"># [1] "Staphylococcus coagulasa negativo (SCN)"</span></span>
<a class="sourceLine" id="cb7-6" data-line-number="6"></a> <span id="cb7-6"><a href="#cb7-6"></a></span>
<a class="sourceLine" id="cb7-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_name("CoNS") on a Dutch system</span></a> <span id="cb7-7"><a href="#cb7-7"></a><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>) <span class="co"># or just mo_name("CoNS") on a Dutch system</span></span>
<a class="sourceLine" id="cb7-8" data-line-number="8"><span class="co"># [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></a> <span id="cb7-8"><a href="#cb7-8"></a><span class="co"># [1] "Coagulase-negatieve Staphylococcus (CNS)"</span></span>
<a class="sourceLine" id="cb7-9" data-line-number="9"></a> <span id="cb7-9"><a href="#cb7-9"></a></span>
<a class="sourceLine" id="cb7-10" data-line-number="10">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</a> <span id="cb7-10"><a href="#cb7-10"></a>run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/pkg/microbenchmark/man/microbenchmark.html">microbenchmark</a></span>(<span class="dt">en =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"en"</span>),</span>
<a class="sourceLine" id="cb7-11" data-line-number="11"> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</a> <span id="cb7-11"><a href="#cb7-11"></a> <span class="dt">de =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"de"</span>),</span>
<a class="sourceLine" id="cb7-12" data-line-number="12"> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</a> <span id="cb7-12"><a href="#cb7-12"></a> <span class="dt">nl =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"nl"</span>),</span>
<a class="sourceLine" id="cb7-13" data-line-number="13"> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</a> <span id="cb7-13"><a href="#cb7-13"></a> <span class="dt">es =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"es"</span>),</span>
<a class="sourceLine" id="cb7-14" data-line-number="14"> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</a> <span id="cb7-14"><a href="#cb7-14"></a> <span class="dt">it =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"it"</span>),</span>
<a class="sourceLine" id="cb7-15" data-line-number="15"> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</a> <span id="cb7-15"><a href="#cb7-15"></a> <span class="dt">fr =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"fr"</span>),</span>
<a class="sourceLine" id="cb7-16" data-line-number="16"> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</a> <span id="cb7-16"><a href="#cb7-16"></a> <span class="dt">pt =</span> <span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"CoNS"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>),</span>
<a class="sourceLine" id="cb7-17" data-line-number="17"> <span class="dt">times =</span> <span class="dv">100</span>)</a> <span id="cb7-17"><a href="#cb7-17"></a> <span class="dt">times =</span> <span class="dv">100</span>)</span>
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="kw"><a href="https://rdrr.io/r/base/print.html">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> <span id="cb7-18"><a href="#cb7-18"></a><span class="kw"><a href="https://rdrr.io/r/base/print.html">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>)</span>
<a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a> <span id="cb7-19"><a href="#cb7-19"></a><span class="co"># Unit: milliseconds</span></span>
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a> <span id="cb7-20"><a href="#cb7-20"></a><span class="co"># expr min lq mean median uq max neval</span></span>
<a class="sourceLine" id="cb7-21" data-line-number="21"><span class="co"># en 23.52 25.12 30.94 26.03 26.90 68.07 100</span></a> <span id="cb7-21"><a href="#cb7-21"></a><span class="co"># en 24.69 25.88 32.93 26.49 28.24 165.60 100</span></span>
<a class="sourceLine" id="cb7-22" data-line-number="22"><span class="co"># de 24.94 26.64 33.82 27.81 30.86 152.10 100</span></a> <span id="cb7-22"><a href="#cb7-22"></a><span class="co"># de 26.07 27.22 32.82 28.08 29.90 75.78 100</span></span>
<a class="sourceLine" id="cb7-23" data-line-number="23"><span class="co"># nl 30.28 32.60 37.42 33.81 35.15 72.52 100</span></a> <span id="cb7-23"><a href="#cb7-23"></a><span class="co"># nl 32.01 33.49 39.63 34.78 36.68 78.48 100</span></span>
<a class="sourceLine" id="cb7-24" data-line-number="24"><span class="co"># es 24.86 26.55 31.91 27.42 28.91 80.24 100</span></a> <span id="cb7-24"><a href="#cb7-24"></a><span class="co"># es 25.66 27.31 32.25 28.04 29.53 68.15 100</span></span>
<a class="sourceLine" id="cb7-25" data-line-number="25"><span class="co"># it 24.54 26.61 32.10 27.45 28.35 69.43 100</span></a> <span id="cb7-25"><a href="#cb7-25"></a><span class="co"># it 25.69 27.13 32.40 28.22 30.01 62.64 100</span></span>
<a class="sourceLine" id="cb7-26" data-line-number="26"><span class="co"># fr 24.75 26.30 30.43 27.50 28.37 64.56 100</span></a> <span id="cb7-26"><a href="#cb7-26"></a><span class="co"># fr 25.77 27.22 33.72 28.03 30.46 71.35 100</span></span>
<a class="sourceLine" id="cb7-27" data-line-number="27"><span class="co"># pt 24.95 26.38 31.37 27.32 28.38 66.08 100</span></a></code></pre></div> <span id="cb7-27"><a href="#cb7-27"></a><span class="co"># pt 25.65 27.12 31.94 27.78 29.08 60.06 100</span></span></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p> <p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div> </div>
</div> </div>
@ -388,20 +380,7 @@
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e', </body>
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html> </html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

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

View File

@ -16,9 +16,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/all.min.css" integrity="sha256-nAmazAk6vS34Xqo0BSrTb+abbtFlgsFK7NKSi6o7Y78=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.7.1/css/v4-shims.min.css" integrity="sha256-6qHlizsOWFskGlwVOKuns+D1nB6ssZrHQrNj1wGplHc=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> <!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/headroom.min.js" integrity="sha256-DJFC1kqIhelURkuza0AvYal5RxMtpzLjFhsnVIeuk+U=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.4/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><!-- docsearch --><script src="../docsearch.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous"> <script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script><link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script><meta property="og:title" content="How to predict antimicrobial resistance"> <script src="../extra.js"></script><meta property="og:title" content="How to predict antimicrobial resistance">
<meta property="og:description" content=""> <meta property="og:description" content="">
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png"> <meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png">
@ -41,7 +39,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -166,13 +164,7 @@
</a> </a>
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div> </div>
</form>
</div>
<!--/.nav-collapse --> <!--/.nav-collapse -->
</div> </div>
<!--/.container --> <!--/.container -->
@ -187,7 +179,7 @@
<h1>How to predict antimicrobial resistance</h1> <h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">26 January 2020</h4> <h4 class="date">23 February 2020</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div> <div class="hidden name"><code>resistance_predict.Rmd</code></div>
@ -201,109 +193,84 @@
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2> <a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p> <p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p> <p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</a> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(dplyr)</span>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2)</a> <span id="cb1-2"><a href="#cb1-2"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(ggplot2)</span>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</a> <span id="cb1-3"><a href="#cb1-3"></a><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span>(AMR)</span>
<a class="sourceLine" id="cb1-4" data-line-number="4"></a> <span id="cb1-4"><a href="#cb1-4"></a></span>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="co"># (if not yet installed, install with:)</span></a> <span id="cb1-5"><a href="#cb1-5"></a><span class="co"># (if not yet installed, install with:)</span></span>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co"># install.packages(c("tidyverse", "AMR"))</span></a></code></pre></div> <span id="cb1-6"><a href="#cb1-6"></a><span class="co"># install.packages(c("tidyverse", "AMR"))</span></span></code></pre></div>
</div> </div>
<div id="prediction-analysis" class="section level2"> <div id="prediction-analysis" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#prediction-analysis" class="anchor"></a>Prediction analysis</h2> <a href="#prediction-analysis" class="anchor"></a>Prediction analysis</h2>
<p>Our package contains a function <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>, which takes the same input as functions for <a href="./AMR.html">other AMR analysis</a>. Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.</p> <p>Our package contains a function <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>, which takes the same input as functions for <a href="./AMR.html">other AMR analysis</a>. Based on a date column, it calculates cases per year and uses a regression model to predict antimicrobial resistance.</p>
<p>It is basically as easy as:</p> <p>It is basically as easy as:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="co"># resistance prediction of piperacillin/tazobactam (TZP):</span></a> <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a><span class="co"># resistance prediction of piperacillin/tazobactam (TZP):</span></span>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">tbl =</span> example_isolates, <span class="dt">col_date =</span> <span class="st">"date"</span>, <span class="dt">col_ab =</span> <span class="st">"TZP"</span>, <span class="dt">model =</span> <span class="st">"binomial"</span>)</a> <span id="cb2-2"><a href="#cb2-2"></a><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">tbl =</span> example_isolates, <span class="dt">col_date =</span> <span class="st">"date"</span>, <span class="dt">col_ab =</span> <span class="st">"TZP"</span>, <span class="dt">model =</span> <span class="st">"binomial"</span>)</span>
<a class="sourceLine" id="cb2-3" data-line-number="3"></a> <span id="cb2-3"><a href="#cb2-3"></a></span>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co"># or:</span></a> <span id="cb2-4"><a href="#cb2-4"></a><span class="co"># or:</span></span>
<a class="sourceLine" id="cb2-5" data-line-number="5">example_isolates <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb2-5"><a href="#cb2-5"></a>example_isolates <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"TZP"</span>,</a> <span id="cb2-6"><a href="#cb2-6"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"TZP"</span>,</span>
<a class="sourceLine" id="cb2-7" data-line-number="7"> model <span class="st">"binomial"</span>)</a> <span id="cb2-7"><a href="#cb2-7"></a> model <span class="st">"binomial"</span>)</span>
<a class="sourceLine" id="cb2-8" data-line-number="8"></a> <span id="cb2-8"><a href="#cb2-8"></a></span>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="co"># to bind it to object 'predict_TZP' for example:</span></a> <span id="cb2-9"><a href="#cb2-9"></a><span class="co"># to bind it to object 'predict_TZP' for example:</span></span>
<a class="sourceLine" id="cb2-10" data-line-number="10">predict_TZP &lt;-<span class="st"> </span>example_isolates <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb2-10"><a href="#cb2-10"></a>predict_TZP &lt;-<span class="st"> </span>example_isolates <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"TZP"</span>,</a> <span id="cb2-11"><a href="#cb2-11"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"TZP"</span>,</span>
<a class="sourceLine" id="cb2-12" data-line-number="12"> <span class="dt">model =</span> <span class="st">"binomial"</span>)</a></code></pre></div> <span id="cb2-12"><a href="#cb2-12"></a> <span class="dt">model =</span> <span class="st">"binomial"</span>)</span></code></pre></div>
<p>The function will look for a date column itself if <code>col_date</code> is not set.</p> <p>The function will look for a date column itself if <code>col_date</code> is not set.</p>
<p>When running any of these commands, a summary of the regression model will be printed unless using <code><a href="../reference/resistance_predict.html">resistance_predict(..., info = FALSE)</a></code>.</p> <p>When running any of these commands, a summary of the regression model will be printed unless using <code><a href="../reference/resistance_predict.html">resistance_predict(..., info = FALSE)</a></code>.</p>
<pre><code># NOTE: Using column `date` as input for `col_date`. <pre><code># NOTE: Using column `date` as input for `col_date`.</code></pre>
#
# Logistic regression model (logit) with binomial distribution
# ------------------------------------------------------------
#
# Call:
# glm(formula = df_matrix ~ year, family = binomial)
#
# Deviance Residuals:
# Min 1Q Median 3Q Max
# -2.6817 -1.4087 -0.5657 0.9672 3.5728
#
# Coefficients:
# Estimate Std. Error z value Pr(&gt;|z|)
# (Intercept) -224.39872 48.03354 -4.672 2.99e-06 ***
# year 0.11061 0.02388 4.633 3.61e-06 ***
# ---
# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# (Dispersion parameter for binomial family taken to be 1)
#
# Null deviance: 61.512 on 14 degrees of freedom
# Residual deviance: 38.692 on 13 degrees of freedom
# AIC: 95.212
#
# Number of Fisher Scoring iterations: 4</code></pre>
<p>This text is only a printed summary - the actual result (output) of the function is a <code>data.frame</code> containing for each year: the number of observations, the actual observed resistance, the estimated resistance and the standard error below and above the estimation:</p> <p>This text is only a printed summary - the actual result (output) of the function is a <code>data.frame</code> containing for each year: the number of observations, the actual observed resistance, the estimated resistance and the standard error below and above the estimation:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">predict_TZP</a> <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a>predict_TZP</span>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="co"># year value se_min se_max observations observed estimated</span></a> <span id="cb4-2"><a href="#cb4-2"></a><span class="co"># year value se_min se_max observations observed estimated</span></span>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="co"># 1 2003 0.06250000 NA NA 32 0.06250000 0.05486389</span></a> <span id="cb4-3"><a href="#cb4-3"></a><span class="co"># 1 2003 0.06250000 NA NA 32 0.06250000 0.05486389</span></span>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co"># 2 2004 0.08536585 NA NA 82 0.08536585 0.06089002</span></a> <span id="cb4-4"><a href="#cb4-4"></a><span class="co"># 2 2004 0.08536585 NA NA 82 0.08536585 0.06089002</span></span>
<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="co"># 3 2005 0.05000000 NA NA 60 0.05000000 0.06753075</span></a> <span id="cb4-5"><a href="#cb4-5"></a><span class="co"># 3 2005 0.05000000 NA NA 60 0.05000000 0.06753075</span></span>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="co"># 4 2006 0.05084746 NA NA 59 0.05084746 0.07483801</span></a> <span id="cb4-6"><a href="#cb4-6"></a><span class="co"># 4 2006 0.05084746 NA NA 59 0.05084746 0.07483801</span></span>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="co"># 5 2007 0.12121212 NA NA 66 0.12121212 0.08286570</span></a> <span id="cb4-7"><a href="#cb4-7"></a><span class="co"># 5 2007 0.12121212 NA NA 66 0.12121212 0.08286570</span></span>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="co"># 6 2008 0.04166667 NA NA 72 0.04166667 0.09166918</span></a> <span id="cb4-8"><a href="#cb4-8"></a><span class="co"># 6 2008 0.04166667 NA NA 72 0.04166667 0.09166918</span></span>
<a class="sourceLine" id="cb4-9" data-line-number="9"><span class="co"># 7 2009 0.01639344 NA NA 61 0.01639344 0.10130461</span></a> <span id="cb4-9"><a href="#cb4-9"></a><span class="co"># 7 2009 0.01639344 NA NA 61 0.01639344 0.10130461</span></span>
<a class="sourceLine" id="cb4-10" data-line-number="10"><span class="co"># 8 2010 0.05660377 NA NA 53 0.05660377 0.11182814</span></a> <span id="cb4-10"><a href="#cb4-10"></a><span class="co"># 8 2010 0.05660377 NA NA 53 0.05660377 0.11182814</span></span>
<a class="sourceLine" id="cb4-11" data-line-number="11"><span class="co"># 9 2011 0.18279570 NA NA 93 0.18279570 0.12329488</span></a> <span id="cb4-11"><a href="#cb4-11"></a><span class="co"># 9 2011 0.18279570 NA NA 93 0.18279570 0.12329488</span></span>
<a class="sourceLine" id="cb4-12" data-line-number="12"><span class="co"># 10 2012 0.30769231 NA NA 65 0.30769231 0.13575768</span></a> <span id="cb4-12"><a href="#cb4-12"></a><span class="co"># 10 2012 0.30769231 NA NA 65 0.30769231 0.13575768</span></span>
<a class="sourceLine" id="cb4-13" data-line-number="13"><span class="co"># 11 2013 0.06896552 NA NA 58 0.06896552 0.14926576</span></a> <span id="cb4-13"><a href="#cb4-13"></a><span class="co"># 11 2013 0.06896552 NA NA 58 0.06896552 0.14926576</span></span>
<a class="sourceLine" id="cb4-14" data-line-number="14"><span class="co"># 12 2014 0.10000000 NA NA 60 0.10000000 0.16386307</span></a> <span id="cb4-14"><a href="#cb4-14"></a><span class="co"># 12 2014 0.10000000 NA NA 60 0.10000000 0.16386307</span></span>
<a class="sourceLine" id="cb4-15" data-line-number="15"><span class="co"># 13 2015 0.23636364 NA NA 55 0.23636364 0.17958657</span></a> <span id="cb4-15"><a href="#cb4-15"></a><span class="co"># 13 2015 0.23636364 NA NA 55 0.23636364 0.17958657</span></span>
<a class="sourceLine" id="cb4-16" data-line-number="16"><span class="co"># 14 2016 0.22619048 NA NA 84 0.22619048 0.19646431</span></a> <span id="cb4-16"><a href="#cb4-16"></a><span class="co"># 14 2016 0.22619048 NA NA 84 0.22619048 0.19646431</span></span>
<a class="sourceLine" id="cb4-17" data-line-number="17"><span class="co"># 15 2017 0.16279070 NA NA 86 0.16279070 0.21451350</span></a> <span id="cb4-17"><a href="#cb4-17"></a><span class="co"># 15 2017 0.16279070 NA NA 86 0.16279070 0.21451350</span></span>
<a class="sourceLine" id="cb4-18" data-line-number="18"><span class="co"># 16 2018 0.23373852 0.2021578 0.2653193 NA NA 0.23373852</span></a> <span id="cb4-18"><a href="#cb4-18"></a><span class="co"># 16 2018 0.23373852 0.2021578 0.2653193 NA NA 0.23373852</span></span>
<a class="sourceLine" id="cb4-19" data-line-number="19"><span class="co"># 17 2019 0.25412909 0.2168525 0.2914057 NA NA 0.25412909</span></a> <span id="cb4-19"><a href="#cb4-19"></a><span class="co"># 17 2019 0.25412909 0.2168525 0.2914057 NA NA 0.25412909</span></span>
<a class="sourceLine" id="cb4-20" data-line-number="20"><span class="co"># 18 2020 0.27565854 0.2321869 0.3191302 NA NA 0.27565854</span></a> <span id="cb4-20"><a href="#cb4-20"></a><span class="co"># 18 2020 0.27565854 0.2321869 0.3191302 NA NA 0.27565854</span></span>
<a class="sourceLine" id="cb4-21" data-line-number="21"><span class="co"># 19 2021 0.29828252 0.2481942 0.3483709 NA NA 0.29828252</span></a> <span id="cb4-21"><a href="#cb4-21"></a><span class="co"># 19 2021 0.29828252 0.2481942 0.3483709 NA NA 0.29828252</span></span>
<a class="sourceLine" id="cb4-22" data-line-number="22"><span class="co"># 20 2022 0.32193804 0.2649008 0.3789753 NA NA 0.32193804</span></a> <span id="cb4-22"><a href="#cb4-22"></a><span class="co"># 20 2022 0.32193804 0.2649008 0.3789753 NA NA 0.32193804</span></span>
<a class="sourceLine" id="cb4-23" data-line-number="23"><span class="co"># 21 2023 0.34654311 0.2823269 0.4107593 NA NA 0.34654311</span></a> <span id="cb4-23"><a href="#cb4-23"></a><span class="co"># 21 2023 0.34654311 0.2823269 0.4107593 NA NA 0.34654311</span></span>
<a class="sourceLine" id="cb4-24" data-line-number="24"><span class="co"># 22 2024 0.37199700 0.3004860 0.4435080 NA NA 0.37199700</span></a> <span id="cb4-24"><a href="#cb4-24"></a><span class="co"># 22 2024 0.37199700 0.3004860 0.4435080 NA NA 0.37199700</span></span>
<a class="sourceLine" id="cb4-25" data-line-number="25"><span class="co"># 23 2025 0.39818127 0.3193839 0.4769787 NA NA 0.39818127</span></a> <span id="cb4-25"><a href="#cb4-25"></a><span class="co"># 23 2025 0.39818127 0.3193839 0.4769787 NA NA 0.39818127</span></span>
<a class="sourceLine" id="cb4-26" data-line-number="26"><span class="co"># 24 2026 0.42496142 0.3390173 0.5109056 NA NA 0.42496142</span></a> <span id="cb4-26"><a href="#cb4-26"></a><span class="co"># 24 2026 0.42496142 0.3390173 0.5109056 NA NA 0.42496142</span></span>
<a class="sourceLine" id="cb4-27" data-line-number="27"><span class="co"># 25 2027 0.45218939 0.3593720 0.5450068 NA NA 0.45218939</span></a> <span id="cb4-27"><a href="#cb4-27"></a><span class="co"># 25 2027 0.45218939 0.3593720 0.5450068 NA NA 0.45218939</span></span>
<a class="sourceLine" id="cb4-28" data-line-number="28"><span class="co"># 26 2028 0.47970658 0.3804212 0.5789920 NA NA 0.47970658</span></a> <span id="cb4-28"><a href="#cb4-28"></a><span class="co"># 26 2028 0.47970658 0.3804212 0.5789920 NA NA 0.47970658</span></span>
<a class="sourceLine" id="cb4-29" data-line-number="29"><span class="co"># 27 2029 0.50734745 0.4021241 0.6125708 NA NA 0.50734745</span></a> <span id="cb4-29"><a href="#cb4-29"></a><span class="co"># 27 2029 0.50734745 0.4021241 0.6125708 NA NA 0.50734745</span></span>
<a class="sourceLine" id="cb4-30" data-line-number="30"><span class="co"># 28 2030 0.53494347 0.4244247 0.6454622 NA NA 0.53494347</span></a></code></pre></div> <span id="cb4-30"><a href="#cb4-30"></a><span class="co"># 28 2030 0.53494347 0.4244247 0.6454622 NA NA 0.53494347</span></span></code></pre></div>
<p>The function <code>plot</code> is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:</p> <p>The function <code>plot</code> is available in base R, and can be extended by other packages to depend the output based on the type of input. We extended its function to cope with resistance predictions:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(predict_TZP)</a></code></pre></div> <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="kw"><a href="https://rdrr.io/r/graphics/plot.html">plot</a></span>(predict_TZP)</span></code></pre></div>
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-4-1.png" width="720"></p> <p><img src="resistance_predict_files/figure-html/unnamed-chunk-4-1.png" width="720"></p>
<p>This is the fastest way to plot the result. It automatically adds the right axes, error bars, titles, number of available observations and type of model.</p> <p>This is the fastest way to plot the result. It automatically adds the right axes, error bars, titles, number of available observations and type of model.</p>
<p>We also support the <code>ggplot2</code> package with our custom function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> to create more appealing plots:</p> <p>We also support the <code>ggplot2</code> package with our custom function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> to create more appealing plots:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_TZP)</a></code></pre></div> <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_TZP)</span></code></pre></div>
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-1.png" width="720"></p> <p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-1.png" width="720"></p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1"></a> <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a></span>
<a class="sourceLine" id="cb7-2" data-line-number="2"><span class="co"># choose for error bars instead of a ribbon</span></a> <span id="cb7-2"><a href="#cb7-2"></a><span class="co"># choose for error bars instead of a ribbon</span></span>
<a class="sourceLine" id="cb7-3" data-line-number="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_TZP, <span class="dt">ribbon =</span> <span class="ot">FALSE</span>)</a></code></pre></div> <span id="cb7-3"><a href="#cb7-3"></a><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(predict_TZP, <span class="dt">ribbon =</span> <span class="ot">FALSE</span>)</span></code></pre></div>
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-2.png" width="720"></p> <p><img src="resistance_predict_files/figure-html/unnamed-chunk-5-2.png" width="720"></p>
<div id="choosing-the-right-model" class="section level3"> <div id="choosing-the-right-model" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#choosing-the-right-model" class="anchor"></a>Choosing the right model</h3> <a href="#choosing-the-right-model" class="anchor"></a>Choosing the right model</h3>
<p>Resistance is not easily predicted; if we look at vancomycin resistance in Gram positives, the spread (i.e. standard error) is enormous:</p> <p>Resistance is not easily predicted; if we look at vancomycin resistance in Gram positives, the spread (i.e. standard error) is enormous:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">example_isolates <span class="op">%&gt;%</span></a> <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a>example_isolates <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo, <span class="dt">language =</span> <span class="ot">NULL</span>) <span class="op">==</span><span class="st"> "Gram-positive"</span>) <span class="op">%&gt;%</span></a> <span id="cb8-2"><a href="#cb8-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo, <span class="dt">language =</span> <span class="ot">NULL</span>) <span class="op">==</span><span class="st"> "Gram-positive"</span>) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"VAN"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>, <span class="dt">model =</span> <span class="st">"binomial"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb8-3"><a href="#cb8-3"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"VAN"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>, <span class="dt">model =</span> <span class="st">"binomial"</span>) <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb8-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</a> <span id="cb8-4"><a href="#cb8-4"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</span>
<a class="sourceLine" id="cb8-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a></code></pre></div> <span id="cb8-5"><a href="#cb8-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span></code></pre></div>
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-6-1.png" width="720"></p> <p><img src="resistance_predict_files/figure-html/unnamed-chunk-6-1.png" width="720"></p>
<p>Vancomycin resistance could be 100% in ten years, but might also stay around 0%.</p> <p>Vancomycin resistance could be 100% in ten years, but might also stay around 0%.</p>
<p>You can define the model with the <code>model</code> parameter. The model chosen above is a generalised linear regression model using a binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance.</p> <p>You can define the model with the <code>model</code> parameter. The model chosen above is a generalised linear regression model using a binomial distribution, assuming that a period of zero resistance was followed by a period of increasing resistance leading slowly to more and more resistance.</p>
@ -344,25 +311,25 @@
</tbody> </tbody>
</table> </table>
<p>For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on the observed years:</p> <p>For the vancomycin resistance in Gram positive bacteria, a linear model might be more appropriate since no (left half of a) binomial distribution is to be expected based on the observed years:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">example_isolates <span class="op">%&gt;%</span></a> <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1"></a>example_isolates <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo, <span class="dt">language =</span> <span class="ot">NULL</span>) <span class="op">==</span><span class="st"> "Gram-positive"</span>) <span class="op">%&gt;%</span></a> <span id="cb9-2"><a href="#cb9-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(mo, <span class="dt">language =</span> <span class="ot">NULL</span>) <span class="op">==</span><span class="st"> "Gram-positive"</span>) <span class="op">%&gt;%</span></span>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"VAN"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>, <span class="dt">model =</span> <span class="st">"linear"</span>) <span class="op">%&gt;%</span><span class="st"> </span></a> <span id="cb9-3"><a href="#cb9-3"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(<span class="dt">col_ab =</span> <span class="st">"VAN"</span>, <span class="dt">year_min =</span> <span class="dv">2010</span>, <span class="dt">info =</span> <span class="ot">FALSE</span>, <span class="dt">model =</span> <span class="st">"linear"</span>) <span class="op">%&gt;%</span><span class="st"> </span></span>
<a class="sourceLine" id="cb9-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</a> <span id="cb9-4"><a href="#cb9-4"></a><span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>()</span>
<a class="sourceLine" id="cb9-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a></code></pre></div> <span id="cb9-5"><a href="#cb9-5"></a><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></span></code></pre></div>
<p><img src="resistance_predict_files/figure-html/unnamed-chunk-7-1.png" width="720"></p> <p><img src="resistance_predict_files/figure-html/unnamed-chunk-7-1.png" width="720"></p>
<p>This seems more likely, doesnt it?</p> <p>This seems more likely, doesnt it?</p>
<p>The model itself is also available from the object, as an <code>attribute</code>:</p> <p>The model itself is also available from the object, as an <code>attribute</code>:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1">model &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/attributes.html">attributes</a></span>(predict_TZP)<span class="op">$</span>model</a> <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1"></a>model &lt;-<span class="st"> </span><span class="kw"><a href="https://rdrr.io/r/base/attributes.html">attributes</a></span>(predict_TZP)<span class="op">$</span>model</span>
<a class="sourceLine" id="cb10-2" data-line-number="2"></a> <span id="cb10-2"><a href="#cb10-2"></a></span>
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(model)<span class="op">$</span>family</a> <span id="cb10-3"><a href="#cb10-3"></a><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(model)<span class="op">$</span>family</span>
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="co"># </span></a> <span id="cb10-4"><a href="#cb10-4"></a><span class="co"># </span></span>
<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="co"># Family: binomial </span></a> <span id="cb10-5"><a href="#cb10-5"></a><span class="co"># Family: binomial </span></span>
<a class="sourceLine" id="cb10-6" data-line-number="6"><span class="co"># Link function: logit</span></a> <span id="cb10-6"><a href="#cb10-6"></a><span class="co"># Link function: logit</span></span>
<a class="sourceLine" id="cb10-7" data-line-number="7"></a> <span id="cb10-7"><a href="#cb10-7"></a></span>
<a class="sourceLine" id="cb10-8" data-line-number="8"><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(model)<span class="op">$</span>coefficients</a> <span id="cb10-8"><a href="#cb10-8"></a><span class="kw"><a href="https://rdrr.io/r/base/summary.html">summary</a></span>(model)<span class="op">$</span>coefficients</span>
<a class="sourceLine" id="cb10-9" data-line-number="9"><span class="co"># Estimate Std. Error z value Pr(&gt;|z|)</span></a> <span id="cb10-9"><a href="#cb10-9"></a><span class="co"># Estimate Std. Error z value Pr(&gt;|z|)</span></span>
<a class="sourceLine" id="cb10-10" data-line-number="10"><span class="co"># (Intercept) -224.3987194 48.0335384 -4.671709 2.987038e-06</span></a> <span id="cb10-10"><a href="#cb10-10"></a><span class="co"># (Intercept) -224.3987194 48.0335384 -4.671709 2.987038e-06</span></span>
<a class="sourceLine" id="cb10-11" data-line-number="11"><span class="co"># year 0.1106102 0.0238753 4.632831 3.606990e-06</span></a></code></pre></div> <span id="cb10-11"><a href="#cb10-11"></a><span class="co"># year 0.1106102 0.0238753 4.632831 3.606990e-06</span></span></code></pre></div>
</div> </div>
</div> </div>
</div> </div>
@ -395,20 +362,7 @@
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script><script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e', </body>
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body>
</html> </html>

View File

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

View File

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

View File

@ -78,7 +78,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9007</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -219,21 +219,17 @@
</div> </div>
<div id="amr-1009007" class="section level1"> <div id="amr-101" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
<a href="#amr-1009007" class="anchor"></a>AMR 1.0.0.9007<small> Unreleased </small> <a href="#amr-101" class="anchor"></a>AMR 1.0.1<small> 2020-02-23 </small>
</h1> </h1>
<div id="last-updated-22-feb-2020" class="section level2">
<h2 class="hasAnchor">
<a href="#last-updated-22-feb-2020" class="anchor"></a><small>Last updated: 22-Feb-2020</small>
</h2>
<div id="changed" class="section level3"> <div id="changed" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#changed" class="anchor"></a>Changed</h3> <a href="#changed" class="anchor"></a>Changed</h3>
<ul> <ul>
<li><p>Fixed floating point error for some MIC compa in EUCAST 2020 guideline</p></li> <li><p>Fixed important floating point error for some MIC comparisons in EUCAST 2020 guideline</p></li>
<li> <li>
<p>Interpretation from MIC values to R/SI can now be used with <code><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the dplyr package:</p> <p>Interpretation from MIC values (and disk zones) to R/SI can now be used with <code><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at()</a></code> of the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a>yourdata <span class="op">%&gt;%</span><span class="st"> </span></span> <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a>yourdata <span class="op">%&gt;%</span><span class="st"> </span></span>
<span id="cb1-2"><a href="#cb1-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(antibiotic1<span class="op">:</span>antibiotic25), as.rsi, <span class="dt">mo =</span> <span class="st">"E. coli"</span>)</span> <span id="cb1-2"><a href="#cb1-2"></a><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(antibiotic1<span class="op">:</span>antibiotic25), as.rsi, <span class="dt">mo =</span> <span class="st">"E. coli"</span>)</span>
<span id="cb1-3"><a href="#cb1-3"></a></span> <span id="cb1-3"><a href="#cb1-3"></a></span>
@ -245,7 +241,6 @@
<li><p>Info printing in functions <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>, <code><a href="../reference/first_isolate.html">first_isolate()</a></code>, <code><a href="../reference/mdro.html">mdro()</a></code> and <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code> will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)</p></li> <li><p>Info printing in functions <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>, <code><a href="../reference/first_isolate.html">first_isolate()</a></code>, <code><a href="../reference/mdro.html">mdro()</a></code> and <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code> will now at default only print when R is in an interactive mode (i.e. not in RMarkdown)</p></li>
</ul> </ul>
</div> </div>
</div>
</div> </div>
<div id="amr-100" class="section level1"> <div id="amr-100" class="section level1">
<h1 class="page-header"> <h1 class="page-header">
@ -1474,7 +1469,7 @@
<div id="tocnav"> <div id="tocnav">
<h2>Contents</h2> <h2>Contents</h2>
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li><a href="#amr-1009007">1.0.0.9007</a></li> <li><a href="#amr-101">1.0.1</a></li>
<li><a href="#amr-100">1.0.0</a></li> <li><a href="#amr-100">1.0.0</a></li>
<li><a href="#amr-090">0.9.0</a></li> <li><a href="#amr-090">0.9.0</a></li>
<li><a href="#amr-080">0.8.0</a></li> <li><a href="#amr-080">0.8.0</a></li>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -80,7 +80,7 @@ This function requires an internet connection." />
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

@ -80,7 +80,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>

View File

@ -80,7 +80,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.0.9007</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,12 +40,6 @@
<script src="../pkgdown.js"></script> <script src="../pkgdown.js"></script>
<!-- docsearch -->
<script src="../docsearch.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous" />
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script>
<link href="../extra.css" rel="stylesheet"> <link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script> <script src="../extra.js"></script>
@ -87,7 +81,7 @@ This page contains a section for every lifecycle (with text borrowed from the af
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -213,12 +207,6 @@ This page contains a section for every lifecycle (with text borrowed from the af
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div>
</form>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div><!--/.container --> </div><!--/.container -->
</div><!--/.navbar --> </div><!--/.navbar -->
@ -317,23 +305,6 @@ The lifecycle of this function is <strong>questioning</strong>. We are no longer
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script>
<script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e',
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body> </body>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -80,7 +80,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9029</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>

View File

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

View File

@ -40,12 +40,6 @@
<script src="../pkgdown.js"></script> <script src="../pkgdown.js"></script>
<!-- docsearch -->
<script src="../docsearch.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous" />
<link href="../docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script>
<link href="../extra.css" rel="stylesheet"> <link href="../extra.css" rel="stylesheet">
<script src="../extra.js"></script> <script src="../extra.js"></script>
@ -90,7 +84,7 @@ below to see their documentation.
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.9.0.9013</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1</span>
</span> </span>
</div> </div>
@ -216,12 +210,6 @@ below to see their documentation.
</li> </li>
</ul> </ul>
<form class="navbar-form navbar-right hidden-xs hidden-sm" role="search">
<div class="form-group">
<input type="search" class="form-control" name="search-input" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
</div>
</form>
</div><!--/.nav-collapse --> </div><!--/.nav-collapse -->
</div><!--/.container --> </div><!--/.container -->
</div><!--/.navbar --> </div><!--/.navbar -->
@ -273,23 +261,6 @@ below to see their documentation.</p>
</div> </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.js" integrity="sha256-GKvGqXDznoRYHCwKXGnuchvKSwmx9SRMrZOTh2g4Sb0=" crossorigin="anonymous"></script>
<script>
docsearch({
apiKey: 'f737050abfd4d726c63938e18f8c496e',
indexName: 'amr',
inputSelector: 'input#search-input.form-control',
transformData: function(hits) {
return hits.map(function (hit) {
hit.url = updateHitURL(hit);
return hit;
});
}
});
</script>
</body> </body>

View File

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

View File

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

View File

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

View File

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