Browse Source

(v0.7.1.9067) honor info

development
parent
commit
34a82d091e
  1. 4
      DESCRIPTION
  2. 2
      NEWS.md
  3. 4
      R/first_isolate.R
  4. 2
      docs/LICENSE-text.html
  5. 400
      docs/articles/AMR.html
  6. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  7. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  8. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  9. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  10. 76
      docs/articles/benchmarks.html
  11. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png
  12. 2
      docs/articles/index.html
  13. 4
      docs/articles/resistance_predict.html
  14. 2
      docs/authors.html
  15. 2
      docs/index.html
  16. 8
      docs/news/index.html
  17. 2
      docs/reference/WHONET.html
  18. 2
      docs/reference/age_groups.html
  19. 2
      docs/reference/as.rsi.html
  20. 2
      docs/reference/availability.html
  21. 2
      docs/reference/bug_drug_combinations.html
  22. 2
      docs/reference/count.html
  23. 2
      docs/reference/eucast_rules.html
  24. 2
      docs/reference/example_isolates.html
  25. 2
      docs/reference/filter_ab_class.html
  26. 2
      docs/reference/first_isolate.html
  27. 2
      docs/reference/ggplot_rsi.html
  28. 2
      docs/reference/index.html
  29. 2
      docs/reference/join.html
  30. 2
      docs/reference/key_antibiotics.html
  31. 2
      docs/reference/like.html
  32. 2
      docs/reference/mdro.html
  33. 2
      docs/reference/portion.html
  34. 2
      docs/reference/resistance_predict.html

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.7.1.9066
Date: 2019-08-27
Version: 0.7.1.9067
Date: 2019-08-28
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),

2
NEWS.md

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# AMR 0.7.1.9066
# AMR 0.7.1.9067
### Breaking
* Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`:

4
R/first_isolate.R

@ -496,7 +496,7 @@ first_isolate <- function(x, @@ -496,7 +496,7 @@ first_isolate <- function(x,
big.mark <- ifelse(decimal.mark != ",", ",", ".")
# handle empty microorganisms
if (any(all_first$newvar_mo == "UNKNOWN", na.rm = TRUE)) {
if (any(all_first$newvar_mo == "UNKNOWN", na.rm = TRUE) & info == TRUE) {
if (include_unknown == TRUE) {
message(blue(paste0("NOTE: Included ", format(sum(all_first$newvar_mo == "UNKNOWN"),
decimal.mark = decimal.mark, big.mark = big.mark),
@ -511,7 +511,7 @@ first_isolate <- function(x, @@ -511,7 +511,7 @@ first_isolate <- function(x,
all_first[which(all_first$newvar_mo == "UNKNOWN"), 'real_first_isolate'] <- include_unknown
# exclude all NAs
if (any(is.na(all_first$newvar_mo))) {
if (any(is.na(all_first$newvar_mo)) & info == TRUE) {
message(blue(paste0("NOTE: Excluded ", format(sum(is.na(all_first$newvar_mo)),
decimal.mark = decimal.mark, big.mark = big.mark),
' isolates with a microbial ID "NA" (column `', bold(col_mo), '`).')))

2
docs/LICENSE-text.html

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

400
docs/articles/AMR.html

@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9063</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9067</span>
</span>
</div>
@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 August 2019</h4>
<h4 class="date">28 August 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -194,7 +194,7 @@ @@ -194,7 +194,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 27 August 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 28 August 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -210,21 +210,21 @@ @@ -210,21 +210,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-08-27</td>
<td align="center">2019-08-28</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2019-08-27</td>
<td align="center">2019-08-28</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2019-08-27</td>
<td align="center">2019-08-28</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -320,70 +320,70 @@ @@ -320,70 +320,70 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2014-06-23</td>
<td align="center">O4</td>
<td align="center">Hospital A</td>
<td align="center">2017-06-03</td>
<td align="center">E4</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2016-10-05</td>
<td align="center">W5</td>
<td align="center">2015-02-25</td>
<td align="center">J4</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">Streptococcus pneumoniae</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">M</td>
</tr>
<tr class="odd">
<td align="center">2017-12-26</td>
<td align="center">S8</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">2014-08-28</td>
<td align="center">F7</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2011-11-26</td>
<td align="center">Z1</td>
<td align="center">2011-12-16</td>
<td align="center">U7</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2014-04-03</td>
<td align="center">Y7</td>
<td align="center">Hospital B</td>
<td align="center">2015-02-09</td>
<td align="center">C8</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2012-06-06</td>
<td align="center">F9</td>
<td align="center">Hospital B</td>
<td align="center">2014-11-26</td>
<td align="center">Y5</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
</tbody>
</table>
@ -406,8 +406,8 @@ @@ -406,8 +406,8 @@
#
# Item Count Percent Cum. Count Cum. Percent
# --- ----- ------- -------- ----------- -------------
# 1 M 10,514 52.6% 10,514 52.6%
# 2 F 9,486 47.4% 20,000 100.0%</code></pre>
# 1 M 10,360 51.8% 10,360 51.8%
# 2 F 9,640 48.2% 20,000 100.0%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -437,14 +437,14 @@ @@ -437,14 +437,14 @@
<a class="sourceLine" id="cb15-18" data-line-number="18"><span class="co"># Pasteurella multocida (no changes)</span></a>
<a class="sourceLine" id="cb15-19" data-line-number="19"><span class="co"># Staphylococcus (no changes)</span></a>
<a class="sourceLine" id="cb15-20" data-line-number="20"><span class="co"># Streptococcus groups A, B, C, G (no changes)</span></a>
<a class="sourceLine" id="cb15-21" data-line-number="21"><span class="co"># Streptococcus pneumoniae (1,504 values changed)</span></a>
<a class="sourceLine" id="cb15-21" data-line-number="21"><span class="co"># Streptococcus pneumoniae (1,477 values changed)</span></a>
<a class="sourceLine" id="cb15-22" data-line-number="22"><span class="co"># Viridans group streptococci (no changes)</span></a>
<a class="sourceLine" id="cb15-23" data-line-number="23"><span class="co"># </span></a>
<a class="sourceLine" id="cb15-24" data-line-number="24"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb15-25" data-line-number="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,298 values changed)</span></a>
<a class="sourceLine" id="cb15-25" data-line-number="25"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,306 values changed)</span></a>
<a class="sourceLine" id="cb15-26" data-line-number="26"><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb15-27" data-line-number="27"><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb15-28" data-line-number="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,705 values changed)</span></a>
<a class="sourceLine" id="cb15-28" data-line-number="28"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,760 values changed)</span></a>
<a class="sourceLine" id="cb15-29" data-line-number="29"><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
<a class="sourceLine" id="cb15-30" data-line-number="30"><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
<a class="sourceLine" id="cb15-31" data-line-number="31"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)</span></a>
@ -452,24 +452,24 @@ @@ -452,24 +452,24 @@
<a class="sourceLine" id="cb15-33" data-line-number="33"><span class="co"># Table 13: Interpretive rules for quinolones (no changes)</span></a>
<a class="sourceLine" id="cb15-34" data-line-number="34"><span class="co"># </span></a>
<a class="sourceLine" id="cb15-35" data-line-number="35"><span class="co"># Other rules</span></a>
<a class="sourceLine" id="cb15-36" data-line-number="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,323 values changed)</span></a>
<a class="sourceLine" id="cb15-37" data-line-number="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (118 values changed)</span></a>
<a class="sourceLine" id="cb15-36" data-line-number="36"><span class="co"># Non-EUCAST: amoxicillin/clav acid = S where ampicillin = S (2,250 values changed)</span></a>
<a class="sourceLine" id="cb15-37" data-line-number="37"><span class="co"># Non-EUCAST: ampicillin = R where amoxicillin/clav acid = R (100 values changed)</span></a>
<a class="sourceLine" id="cb15-38" data-line-number="38"><span class="co"># Non-EUCAST: piperacillin = R where piperacillin/tazobactam = R (no changes)</span></a>
<a class="sourceLine" id="cb15-39" data-line-number="39"><span class="co"># Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
<a class="sourceLine" id="cb15-40" data-line-number="40"><span class="co"># Non-EUCAST: trimethoprim = R where trimethoprim/sulfa = R (no changes)</span></a>
<a class="sourceLine" id="cb15-41" data-line-number="41"><span class="co"># Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
<a class="sourceLine" id="cb15-42" data-line-number="42"><span class="co"># </span></a>
<a class="sourceLine" id="cb15-43" data-line-number="43"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb15-44" data-line-number="44"><span class="co"># EUCAST rules affected 6,559 out of 20,000 rows, making a total of 7,948 edits</span></a>
<a class="sourceLine" id="cb15-44" data-line-number="44"><span class="co"># EUCAST rules affected 6,548 out of 20,000 rows, making a total of 7,893 edits</span></a>
<a class="sourceLine" id="cb15-45" data-line-number="45"><span class="co"># =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb15-46" data-line-number="46"><span class="co"># </span></a>
<a class="sourceLine" id="cb15-47" data-line-number="47"><span class="co"># =&gt; changed 7,948 test results</span></a>
<a class="sourceLine" id="cb15-48" data-line-number="48"><span class="co"># - 115 test results changed from S to I</span></a>
<a class="sourceLine" id="cb15-49" data-line-number="49"><span class="co"># - 4,723 test results changed from S to R</span></a>
<a class="sourceLine" id="cb15-50" data-line-number="50"><span class="co"># - 1,098 test results changed from I to S</span></a>
<a class="sourceLine" id="cb15-51" data-line-number="51"><span class="co"># - 338 test results changed from I to R</span></a>
<a class="sourceLine" id="cb15-52" data-line-number="52"><span class="co"># - 1,648 test results changed from R to S</span></a>
<a class="sourceLine" id="cb15-53" data-line-number="53"><span class="co"># - 26 test results changed from R to I</span></a>
<a class="sourceLine" id="cb15-47" data-line-number="47"><span class="co"># =&gt; changed 7,893 test results</span></a>
<a class="sourceLine" id="cb15-48" data-line-number="48"><span class="co"># - 102 test results changed from S to I</span></a>
<a class="sourceLine" id="cb15-49" data-line-number="49"><span class="co"># - 4,732 test results changed from S to R</span></a>
<a class="sourceLine" id="cb15-50" data-line-number="50"><span class="co"># - 1,108 test results changed from I to S</span></a>
<a class="sourceLine" id="cb15-51" data-line-number="51"><span class="co"># - 328 test results changed from I to R</span></a>
<a class="sourceLine" id="cb15-52" data-line-number="52"><span class="co"># - 1,603 test results changed from R to S</span></a>
<a class="sourceLine" id="cb15-53" data-line-number="53"><span class="co"># - 20 test results changed from R to I</span></a>
<a class="sourceLine" id="cb15-54" data-line-number="54"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb15-55" data-line-number="55"><span class="co"># </span></a>
<a class="sourceLine" id="cb15-56" data-line-number="56"><span class="co"># Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -497,7 +497,7 @@ @@ -497,7 +497,7 @@
<a class="sourceLine" id="cb17-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb17-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb17-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb17-6" data-line-number="6"><span class="co"># =&gt; Found 5,672 first isolates (28.4% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb17-6" data-line-number="6"><span class="co"># =&gt; Found 5,693 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 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="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
@ -508,7 +508,7 @@ @@ -508,7 +508,7 @@
<div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor">
<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 K7, 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 Q3, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -524,43 +524,43 @@ @@ -524,43 +524,43 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-02-15</td>
<td align="center">K7</td>
<td align="center">2010-01-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-24</td>
<td align="center">K7</td>
<td align="center">2010-03-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-05</td>
<td align="center">K7</td>
<td align="center">2010-04-30</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-07-16</td>
<td align="center">K7</td>
<td align="center">2010-07-02</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -568,21 +568,21 @@ @@ -568,21 +568,21 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-09-22</td>
<td align="center">K7</td>
<td align="center">2010-10-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-01-18</td>
<td align="center">K7</td>
<td align="center">2010-11-26</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -590,8 +590,8 @@ @@ -590,8 +590,8 @@
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-01-26</td>
<td align="center">K7</td>
<td align="center">2011-01-09</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -601,30 +601,30 @@ @@ -601,30 +601,30 @@
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-02-11</td>
<td align="center">K7</td>
<td align="center">2011-02-01</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-02-17</td>
<td align="center">K7</td>
<td align="center">2011-03-20</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-04-01</td>
<td align="center">K7</td>
<td align="center">2011-08-04</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -645,7 +645,7 @@ @@ -645,7 +645,7 @@
<a class="sourceLine" id="cb20-7" data-line-number="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb20-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb20-9" data-line-number="9"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb20-10" data-line-number="10"><span class="co"># =&gt; Found 15,107 first weighted isolates (75.5% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb20-10" data-line-number="10"><span class="co"># =&gt; Found 15,134 first weighted isolates (75.7% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -662,23 +662,23 @@ @@ -662,23 +662,23 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-02-15</td>
<td align="center">K7</td>
<td align="center">2010-01-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-24</td>
<td align="center">K7</td>
<td align="center">2010-03-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -686,46 +686,46 @@ @@ -686,46 +686,46 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-05</td>
<td align="center">K7</td>
<td align="center">2010-04-30</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-07-16</td>
<td align="center">K7</td>
<td align="center">2010-07-02</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-09-22</td>
<td align="center">K7</td>
<td align="center">2010-10-10</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-01-18</td>
<td align="center">K7</td>
<td align="center">2010-11-26</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -734,44 +734,44 @@ @@ -734,44 +734,44 @@
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-01-26</td>
<td align="center">K7</td>
<td align="center">2011-01-09</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-02-11</td>
<td align="center">K7</td>
<td align="center">2011-02-01</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-02-17</td>
<td align="center">K7</td>
<td align="center">2011-03-20</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-04-01</td>
<td align="center">K7</td>
<td align="center">2011-08-04</td>
<td align="center">Q3</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -782,11 +782,11 @@ @@ -782,11 +782,11 @@
</tr>
</tbody>
</table>
<p>Instead of 2, now 7 isolates are flagged. In total, of all isolates are marked ‘first weighted’ - 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 8 isolates are flagged. In total, of all isolates are marked ‘first weighted’ - more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,107 isolates for analysis.</p>
<p>So we end up with 15,134 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb22-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
@ -812,15 +812,15 @@ @@ -812,15 +812,15 @@
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2014-06-23</td>
<td align="center">O4</td>
<td align="center">Hospital A</td>
<td align="center">2017-06-03</td>
<td align="center">E4</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
@ -828,41 +828,41 @@ @@ -828,41 +828,41 @@
</tr>
<tr class="even">
<td>2</td>
<td align="center">2016-10-05</td>
<td align="center">W5</td>
<td align="center">2015-02-25</td>
<td align="center">J4</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">B_STRPT_PNE</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>3</td>
<td align="center">2017-12-26</td>
<td align="center">S8</td>
<td>4</td>
<td align="center">2011-12-16</td>
<td align="center">U7</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</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>5</td>
<td align="center">2014-04-03</td>
<td align="center">Y7</td>
<td align="center">Hospital B</td>
<td>6</td>
<td align="center">2014-11-26</td>
<td align="center">Y5</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
@ -876,29 +876,29 @@ @@ -876,29 +876,29 @@
</tr>
<tr class="odd">
<td>7</td>
<td align="center">2011-05-16</td>
<td align="center">I8</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td align="center">2010-08-09</td>
<td align="center">C5</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td>8</td>
<td align="center">2014-12-28</td>
<td align="center">Z2</td>
<td align="center">2011-07-24</td>
<td align="center">W6</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
@ -925,7 +925,7 @@ @@ -925,7 +925,7 @@
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" data-line-number="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq</a></span>(genus, species)</a></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 15,107 (of which NA: 0 = 0.00%)<br>
Length: 15,134 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -942,33 +942,33 @@ Longest: 24</p> @@ -942,33 +942,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,471</td>
<td align="right">49.5%</td>
<td align="right">7,471</td>
<td align="right">49.5%</td>
<td align="right">7,330</td>
<td align="right">48.4%</td>
<td align="right">7,330</td>
<td align="right">48.4%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,789</td>
<td align="right">25.1%</td>
<td align="right">11,260</td>
<td align="right">74.5%</td>
<td align="right">3,816</td>
<td align="right">25.2%</td>
<td align="right">11,146</td>
<td align="right">73.6%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,296</td>
<td align="right">15.2%</td>
<td align="right">13,556</td>
<td align="right">89.7%</td>
<td align="right">2,386</td>
<td align="right">15.8%</td>
<td align="right">13,532</td>
<td align="right">89.4%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,551</td>
<td align="right">10.3%</td>
<td align="right">15,107</td>
<td align="right">1,602</td>
<td align="right">10.6%</td>
<td align="right">15,134</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -979,7 +979,7 @@ Longest: 24</p> @@ -979,7 +979,7 @@ Longest: 24</p>
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
<p>The functions <code><a href="../reference/portion.html">portion_S()</a></code>, <code><a href="../reference/portion.html">portion_SI()</a></code>, <code><a href="../reference/portion.html">portion_I()</a></code>, <code><a href="../reference/portion.html">portion_IR()</a></code> and <code><a href="../reference/portion.html">portion_R()</a></code> can be used to determine the portion of a specific antimicrobial outcome. As per the EUCAST guideline of 2019, we calculate resistance as the portion of R (<code><a href="../reference/portion.html">portion_R()</a></code>) and susceptibility as the portion of S and I (<code><a href="../reference/portion.html">portion_SI()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" data-line-number="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_R</a></span>(AMX)</a>
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="co"># [1] 0.4685245</span></a></code></pre></div>
<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="co"># [1] 0.4649795</span></a></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" data-line-number="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb27-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>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -992,19 +992,19 @@ Longest: 24</p> @@ -992,19 +992,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4686054</td>
<td align="center">0.4684865</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4644004</td>
<td align="center">0.4595616</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4821269</td>
<td align="center">0.4685616</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4655684</td>
<td align="center">0.4664897</td>
</tr>
</tbody>
</table>
@ -1022,23 +1022,23 @@ Longest: 24</p> @@ -1022,23 +1022,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4686054</td>
<td align="center">4539</td>
<td align="center">0.4684865</td>
<td align="center">4506</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4644004</td>
<td align="center">5295</td>
<td align="center">0.4595616</td>
<td align="center">5292</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4821269</td>
<td align="center">2238</td>
<td align="center">0.4685616</td>
<td align="center">2322</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4655684</td>
<td align="center">3035</td>
<td align="center">0.4664897</td>
<td align="center">3014</td>
</tr>
</tbody>
</table>
@ -1058,27 +1058,27 @@ Longest: 24</p> @@ -1058,27 +1058,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.9243742</td>
<td align="center">0.8933208</td>
<td align="center">0.9950475</td>
<td align="center">0.9289222</td>
<td align="center">0.8896317</td>
<td align="center">0.9924966</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8149581</td>
<td align="center">0.8884591</td>
<td align="center">0.9787234</td>
<td align="center">0.8021223</td>
<td align="center">0.9082397</td>
<td align="center">0.9812734</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.9192399</td>
<td align="center">0.9160728</td>
<td align="center">0.9912906</td>
<td align="center">0.9263627</td>
<td align="center">0.9129979</td>
<td align="center">0.9900419</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5997387</td>
<td align="center">0.6240570</td>
<td align="center">0.0000000</td>
<td align="center">0.5997387</td>
<td align="center">0.6240570</td>
</tr>
</tbody>
</table>

BIN
docs/articles/AMR_files/figure-html/plot 1-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

BIN
docs/articles/AMR_files/figure-html/plot 3-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

BIN
docs/articles/AMR_files/figure-html/plot 4-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

BIN
docs/articles/AMR_files/figure-html/plot 5-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

76
docs/articles/benchmarks.html

@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9063</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9067</span>
</span>
</div>
@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
<h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">27 August 2019</h4>
<h4 class="date">28 August 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -210,14 +210,14 @@ @@ -210,14 +210,14 @@
<a class="sourceLine" id="cb2-8" data-line-number="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># as.mo("sau") 8.1 8.1 8.3 8.3 8.4 8.6 10</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># as.mo("stau") 31.0 31.0 48.0 40.0 48.0 130.0 10</span></a>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># as.mo("staaur") 8.1 8.3 10.0 8.4 8.6 24.0 10</span></a>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># as.mo("STAAUR") 8.1 8.1 12.0 8.4 9.2 28.0 10</span></a>
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="co"># as.mo("S. aureus") 22.0 23.0 26.0 23.0 24.0 40.0 10</span></a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="co"># as.mo("S. aureus") 22.0 23.0 23.0 23.0 23.0 24.0 10</span></a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># as.mo("Staphylococcus aureus") 3.6 3.8 4.0 3.9 4.0 5.2 10</span></a></code></pre></div>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># as.mo("sau") 8.4 8.5 16.0 9.7 25.0 27 10</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># as.mo("stau") 31.0 31.0 33.0 31.0 33.0 49 10</span></a>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># as.mo("staaur") 8.1 8.3 13.0 8.5 23.0 24 10</span></a>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># as.mo("STAAUR") 8.2 8.5 9.1 8.9 9.4 11 10</span></a>
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="co"># as.mo("S. aureus") 22.0 22.0 23.0 23.0 23.0 24 10</span></a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="co"># as.mo("S. aureus") 22.0 23.0 34.0 23.0 24.0 110 10</span></a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># as.mo("Staphylococcus aureus") 3.8 3.9 5.0 4.0 4.3 12 10</span></a></code></pre></div>
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">T.islandicus &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
@ -229,12 +229,12 @@ @@ -229,12 +229,12 @@
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 260 270 280 280 290 300 10</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 260 280 300 290 300 370 10</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 130 140 140 140 150 150 10</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 130 130 130 130 140 150 10</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 47 48 53 50 52 71 10</span></a></code></pre></div>
<p>That takes 9.6 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 260 280 280 280 290 290 10</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 250 260 280 280 290 300 10</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 120 130 130 130 150 150 10</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 120 130 140 140 140 150 10</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 47 47 53 48 62 67 10</span></a></code></pre></div>
<p>That takes 9.3 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2"></a>
@ -280,8 +280,8 @@ @@ -280,8 +280,8 @@
<a class="sourceLine" id="cb5-24" data-line-number="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb5-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-27" data-line-number="27"><span class="co"># mo_name(x) 611 618 646 642 656 720 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.64 seconds (641 ms). You only lose time on your unique input values.</p>
<a class="sourceLine" id="cb5-27" data-line-number="27"><span class="co"># mo_name(x) 587 591 604 594 612 653 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.59 seconds (594 ms). You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
@ -293,11 +293,11 @@ @@ -293,11 +293,11 @@
<a class="sourceLine" id="cb6-4" data-line-number="4"> <span class="dt"