Browse Source

benchmarks plots

main
parent
commit
efb2af9e3a
  1. 2
      DESCRIPTION
  2. 9
      R/freq.R
  3. BIN
      data/microorganisms.codes.rda
  4. 405
      docs/articles/AMR.html
  5. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  6. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  7. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  8. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  9. 2
      docs/articles/EUCAST.html
  10. 8
      docs/articles/G_test.html
  11. 54
      docs/articles/WHONET.html
  12. 2
      docs/articles/atc_property.html
  13. 262
      docs/articles/benchmarks.html
  14. 134
      docs/articles/freq.html
  15. 2
      docs/articles/mo_property.html
  16. 2
      docs/articles/resistance_predict.html
  17. 6
      docs/reference/AMR-deprecated.html
  18. 6
      docs/reference/AMR.html
  19. 6
      docs/reference/ITIS.html
  20. 6
      docs/reference/WHOCC.html
  21. 6
      docs/reference/WHONET.html
  22. 6
      docs/reference/abname.html
  23. 6
      docs/reference/age.html
  24. 6
      docs/reference/age_groups.html
  25. 6
      docs/reference/antibiotics.html
  26. 6
      docs/reference/as.atc.html
  27. 6
      docs/reference/as.mic.html
  28. 6
      docs/reference/as.mo.html
  29. 6
      docs/reference/as.rsi.html
  30. 6
      docs/reference/atc_online.html
  31. 6
      docs/reference/atc_property.html
  32. 6
      docs/reference/availability.html
  33. 6
      docs/reference/count.html
  34. 6
      docs/reference/eucast_rules.html
  35. BIN
      docs/reference/figures/benchmark_1.png
  36. BIN
      docs/reference/figures/benchmark_2.png
  37. 6
      docs/reference/first_isolate.html
  38. 6
      docs/reference/freq.html
  39. 6
      docs/reference/g.test.html
  40. 6
      docs/reference/get_locale.html
  41. 6
      docs/reference/ggplot_rsi.html
  42. 6
      docs/reference/guess_ab_col.html
  43. 6
      docs/reference/join.html
  44. 6
      docs/reference/key_antibiotics.html
  45. 6
      docs/reference/kurtosis.html
  46. 6
      docs/reference/like.html
  47. 6
      docs/reference/mdro.html
  48. 6
      docs/reference/microorganisms.codes.html
  49. 6
      docs/reference/microorganisms.html
  50. 6
      docs/reference/microorganisms.old.html
  51. 6
      docs/reference/mo_property.html
  52. 6
      docs/reference/mo_source.html
  53. 6
      docs/reference/p.symbol.html
  54. 6
      docs/reference/portion.html
  55. 6
      docs/reference/read.4D.html
  56. 18
      docs/reference/resistance_predict.html
  57. 6
      docs/reference/rsi.html
  58. 6
      docs/reference/septic_patients.html
  59. 6
      docs/reference/skewness.html
  60. 6
      docs/reference/supplementary_data.html
  61. BIN
      man/figures/benchmark_1.png
  62. BIN
      man/figures/benchmark_2.png
  63. 104
      vignettes/benchmarks.Rmd

2
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.5.0.9017
Date: 2019-02-13
Date: 2019-02-14
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(

9
R/freq.R

@ -667,16 +667,17 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ", @@ -667,16 +667,17 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
header <- header[names(header) != "na_length"]
# format all numeric values
header <- lapply(header, function(x)
if (is.numeric(x))
header <- lapply(header, function(x) {
if (is.numeric(x)) {
if (any(x < 1000)) {
format(round2(x, digits = digits), decimal.mark = decimal.mark, big.mark = big.mark)
} else {
format(x, digits = digits, decimal.mark = decimal.mark, big.mark = big.mark)
}
else
} else {
x
)
}
})
# numeric values
if (has_length == TRUE & any(x_class %in% c("double", "integer", "numeric", "raw", "single"))) {

BIN
data/microorganisms.codes.rda

Binary file not shown.

405
docs/articles/AMR.html

@ -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">12 February 2019</h4>
<h4 class="date">14 February 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/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 12 February 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/">RMarkdown</a>. However, the methodology remains unchanged. This page was generated on 14 February 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-02-12</td>
<td align="center">2019-02-14</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-02-12</td>
<td align="center">2019-02-14</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-02-12</td>
<td align="center">2019-02-14</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -320,32 +320,32 @@ @@ -320,32 +320,32 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2012-04-28</td>
<td align="center">X6</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">2016-08-15</td>
<td align="center">E9</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2012-12-23</td>
<td align="center">Z1</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">I</td>
<td align="center">2013-02-21</td>
<td align="center">I8</td>
<td align="center">Hospital D</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2011-05-27</td>
<td align="center">G10</td>
<td align="center">2015-05-12</td>
<td align="center">F4</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -353,21 +353,21 @@ @@ -353,21 +353,21 @@
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2012-08-19</td>
<td align="center">Q1</td>
<td align="center">Hospital D</td>
<td align="center">2013-09-20</td>
<td align="center">M3</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="odd">
<td align="center">2016-05-06</td>
<td align="center">Y2</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">2013-08-03</td>
<td align="center">V8</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -375,15 +375,15 @@ @@ -375,15 +375,15 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-08-27</td>
<td align="center">I8</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">2017-10-01</td>
<td align="center">V9</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
</tbody>
</table>
@ -398,14 +398,14 @@ @@ -398,14 +398,14 @@
<pre><code>#&gt; Frequency table of `gender` from a data.frame (20,000 x 9)
#&gt;
#&gt; Class: factor (numeric)
#&gt; Levels: F, M
#&gt; Length: 20,000 (of which NA: 0 = 0.00%)
#&gt; Levels: 2: F, M
#&gt; Unique: 2
#&gt;
#&gt; Item Count Percent Cum. Count Cum. Percent
#&gt; --- ----- ------- -------- ----------- -------------
#&gt; 1 M 10,303 51.5% 10,303 51.5%
#&gt; 2 F 9,697 48.5% 20,000 100.0%</code></pre>
#&gt; 1 M 10,444 52.2% 10,444 52.2%
#&gt; 2 F 9,556 47.8% 20,000 100.0%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientist perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researcher perspective: there are slightly more men. Nothing we didn’t already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -436,10 +436,10 @@ @@ -436,10 +436,10 @@
<a class="sourceLine" id="cb14-19" title="19"><span class="co">#&gt; Kingella kingae (no changes)</span></a>
<a class="sourceLine" id="cb14-20" title="20"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-21" title="21"><span class="co">#&gt; EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1278 changes)</span></a>
<a class="sourceLine" id="cb14-22" title="22"><span class="co">#&gt; Table 1: Intrinsic resistance in Enterobacteriaceae (1293 changes)</span></a>
<a class="sourceLine" id="cb14-23" title="23"><span class="co">#&gt; Table 2: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-24" title="24"><span class="co">#&gt; Table 3: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2750 changes)</span></a>
<a class="sourceLine" id="cb14-25" title="25"><span class="co">#&gt; Table 4: Intrinsic resistance in Gram-positive bacteria (2812 changes)</span></a>
<a class="sourceLine" id="cb14-26" title="26"><span class="co">#&gt; Table 8: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
<a class="sourceLine" id="cb14-27" title="27"><span class="co">#&gt; Table 9: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
<a class="sourceLine" id="cb14-28" title="28"><span class="co">#&gt; Table 10: Interpretive rules for B-lactam agents and other Gram-negative bacteria (no changes)</span></a>
@ -455,9 +455,9 @@ @@ -455,9 +455,9 @@
<a class="sourceLine" id="cb14-38" title="38"><span class="co">#&gt; Non-EUCAST: piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
<a class="sourceLine" id="cb14-39" title="39"><span class="co">#&gt; Non-EUCAST: trimethoprim/sulfa = S where trimethoprim = S (no changes)</span></a>
<a class="sourceLine" id="cb14-40" title="40"><span class="co">#&gt; </span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,442 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-41" title="41"><span class="co">#&gt; =&gt; EUCAST rules affected 7,447 out of 20,000 rows</span></a>
<a class="sourceLine" id="cb14-42" title="42"><span class="co">#&gt; -&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,028 test results (0 to S; 0 to I; 4,028 to R)</span></a></code></pre></div>
<a class="sourceLine" id="cb14-43" title="43"><span class="co">#&gt; -&gt; changed 4,105 test results (0 to S; 0 to I; 4,105 to R)</span></a></code></pre></div>
</div>
<div id="adding-new-variables" class="section level1">
<h1 class="hasAnchor">
@ -482,8 +482,8 @@ @@ -482,8 +482,8 @@
<a class="sourceLine" id="cb16-3" title="3"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" title="4"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" title="5"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,652 first isolates (28.3% of total)</span></a></code></pre></div>
<p>So only 28.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<a class="sourceLine" id="cb16-6" title="6"><span class="co">#&gt; =&gt; Found 5,692 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 28.5% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -509,32 +509,32 @@ @@ -509,32 +509,32 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-15</td>
<td align="center">V8</td>
<td align="center">2010-06-20</td>
<td align="center">Y4</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">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-02-08</td>
<td align="center">V8</td>
<td align="center">2010-07-31</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-02-24</td>
<td align="center">V8</td>
<td align="center">2010-08-26</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -542,8 +542,8 @@ @@ -542,8 +542,8 @@
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-04-28</td>
<td align="center">V8</td>
<td align="center">2010-12-11</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -553,8 +553,8 @@ @@ -553,8 +553,8 @@
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-05-13</td>
<td align="center">V8</td>
<td align="center">2010-12-30</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -564,62 +564,62 @@ @@ -564,62 +564,62 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-05-14</td>
<td align="center">V8</td>
<td align="center">2011-04-02</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-08-04</td>
<td align="center">V8</td>
<td align="center">2011-04-06</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-09-12</td>
<td align="center">V8</td>
<td align="center">2011-04-07</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-10-03</td>
<td align="center">V8</td>
<td align="center">2011-05-28</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-01-09</td>
<td align="center">V8</td>
<td align="center">2011-09-09</td>
<td align="center">Y4</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">TRUE</td>
</tr>
</tbody>
</table>
<p>Only 1 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>Only 2 isolates are marked as ‘first’ according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>If a column exists with a name like ‘key(…)ab’ the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb19-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">keyab =</span> <span class="kw"><a href="../reference/key_antibiotics.html">key_antibiotics</a></span>(.)) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -630,7 +630,7 @@ @@ -630,7 +630,7 @@
<a class="sourceLine" id="cb19-7" title="7"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" title="8"><span class="co">#&gt; </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" title="9"><span class="co">#&gt; [Criterion] Inclusion based on key antibiotics, ignoring I.</span></a>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,783 first weighted isolates (78.9% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" title="10"><span class="co">#&gt; =&gt; Found 15,866 first weighted isolates (79.3% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -647,56 +647,56 @@ @@ -647,56 +647,56 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-15</td>
<td align="center">V8</td>
<td align="center">2010-06-20</td>
<td align="center">Y4</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">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-02-08</td>
<td align="center">V8</td>
<td align="center">2010-07-31</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-02-24</td>
<td align="center">V8</td>
<td align="center">2010-08-26</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-04-28</td>
<td align="center">V8</td>
<td align="center">2010-12-11</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-05-13</td>
<td align="center">V8</td>
<td align="center">2010-12-30</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
@ -707,47 +707,47 @@ @@ -707,47 +707,47 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-05-14</td>
<td align="center">V8</td>
<td align="center">2011-04-02</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-08-04</td>
<td align="center">V8</td>
<td align="center">2011-04-06</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2010-09-12</td>
<td align="center">V8</td>
<td align="center">2011-04-07</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2010-10-03</td>
<td align="center">V8</td>
<td align="center">2011-05-28</td>
<td align="center">Y4</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -755,23 +755,23 @@ @@ -755,23 +755,23 @@
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-01-09</td>
<td align="center">V8</td>
<td align="center">2011-09-09</td>
<td align="center">Y4</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">TRUE</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Instead of 1, now 8 isolates are flagged. In total, 78.9% of all isolates are marked ‘first weighted’ - 50.7% 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, 79.3% of all isolates are marked ‘first weighted’ - 50.9% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb20-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,783 isolates for analysis.</p>
<p>So we end up with 15,866 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(first, keyab))</a></code></pre></div>
@ -779,6 +779,7 @@ @@ -779,6 +779,7 @@
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(data_1st)</a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th></th>
<th align="center">date</th>
<th align="center">patient_id</th>
<th align="center">hospital</th>
@ -795,88 +796,94 @@ @@ -795,88 +796,94 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2012-04-28</td>
<td align="center">X6</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td>1</td>
<td align="center">2016-08-15</td>
<td align="center">E9</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AUR</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 negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</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-12-23</td>
<td align="center">Z1</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">I</td>
<td>2</td>
<td align="center">2013-02-21</td>
<td align="center">I8</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPTC_PNE</td>
<td align="center">S</td>
<td align="center">I</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">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 align="center">2011-05-27</td>
<td align="center">G10</td>
<td>3</td>
<td align="center">2015-05-12</td>
<td align="center">F4</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPTC_PNE</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">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">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">2012-08-19</td>
<td align="center">Q1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COL</td>
<td>5</td>
<td align="center">2013-08-03</td>
<td align="center">V8</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPTC_PNE</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">Gram positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2016-05-06</td>
<td align="center">Y2</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNE</td>
<td align="center">R</td>
<td>6</td>
<td align="center">2017-10-01</td>
<td align="center">V9</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AUR</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</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">2010-08-27</td>
<td align="center">I8</td>
<td align="center">Hospital A</td>
<td>7</td>
<td align="center">2014-06-20</td>
<td align="center">E9</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COL</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram negative</td>
@ -901,9 +908,9 @@ @@ -901,9 +908,9 @@
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/paste">paste</a></span>(data_1st<span class="op">$</span>genus, data_1st<span class="op">$</span>species))</a></code></pre></div>
<p>Or can be used like the <code>dplyr</code> way, which is easier readable:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus, species)</a></code></pre></div>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,783 x 13)</strong></p>
<p><strong>Frequency table of <code>genus</code> and <code>species</code> from a <code>data.frame</code> (15,866 x 13)</strong></p>
<p>Columns: 2<br>
Length: 15,783 (of which NA: 0 = 0.00%)<br>
Length: 15,866 (of which NA: 0 = 0.00%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -920,33 +927,33 @@ Longest: 24</p> @@ -920,33 +927,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,825</td>
<td align="right">49.6%</td>
<td align="right">7,825</td>
<td align="right">49.6%</td>
<td align="right">7,860</td>
<td align="right">49.5%</td>
<td align="right">7,860</td>
<td align="right">49.5%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,979</td>
<td align="right">25.2%</td>
<td align="right">11,804</td>
<td align="right">74.8%</td>
<td align="right">3,892</td>
<td align="right">24.5%</td>
<td align="right">11,752</td>
<td align="right">74.1%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,449</td>
<td align="right">15.5%</td>
<td align="right">14,253</td>
<td align="right">90.3%</td>
<td align="right">2,556</td>
<td align="right">16.1%</td>
<td align="right">14,308</td>
<td align="right">90.2%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,530</td>
<td align="right">9.7%</td>
<td align="right">15,783</td>
<td align="right">1,558</td>
<td align="right">9.8%</td>
<td align="right">15,866</td>
<td align="right">100.0%</td>
</tr>
</tbody>
@ -957,7 +964,7 @@ Longest: 24</p> @@ -957,7 +964,7 @@ Longest: 24</p>
<a href="#resistance-percentages" class="anchor"></a>Resistance percentages</h2>
<p>The functions <code>portion_R</code>, <code>portion_RI</code>, <code>portion_I</code>, <code>portion_IS</code> and <code>portion_S</code> can be used to determine the portion of a specific antimicrobial outcome. They can be used on their own:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_IR</a></span>(amox)</a>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4756383</span></a></code></pre></div>
<a class="sourceLine" id="cb25-2" title="2"><span class="co">#&gt; [1] 0.4766797</span></a></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb26-2" title="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(hospital) <span class="op">%&gt;%</span><span class="st"> </span></a>
@ -970,19 +977,19 @@ Longest: 24</p> @@ -970,19 +977,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4697326</td>
<td align="center">0.4749633</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4770958</td>
<td align="center">0.4879713</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4799670</td>
<td align="center">0.4761905</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4785082</td>
<td align="center">0.4600062</td>
</tr>
</tbody>
</table>
@ -1000,23 +1007,23 @@ Longest: 24</p> @@ -1000,23 +1007,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4697326</td>
<td align="center">4675</td>
<td align="center">0.4749633</td>
<td align="center">4773</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4770958</td>
<td align="center">5523</td>
<td align="center">0.4879713</td>
<td align="center">5570</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4799670</td>
<td align="center">2421</td>
<td align="center">0.4761905</td>
<td align="center">2310</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4785082</td>
<td align="center">3164</td>
<td align="center">0.4600062</td>
<td align="center">3213</td>
</tr>
</tbody>
</table>
@ -1036,27 +1043,27 @@ Longest: 24</p> @@ -1036,27 +1043,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7345687</td>
<td align="center">0.9051757</td>
<td align="center">0.9773802</td>
<td align="center">0.7249364</td>
<td align="center">0.8996183</td>
<td align="center">0.9725191</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.7307190</td>
<td align="center">0.9071895</td>
<td align="center">0.9771242</td>
<td align="center">0.7291399</td>
<td align="center">0.9037227</td>
<td align="center">0.9762516</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7353606</td>
<td align="center">0.9210857</td>
<td align="center">0.9816537</td>
<td align="center">0.7410072</td>
<td align="center">0.9229188</td>
<td align="center">0.9786742</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.7268273</td>
<td align="center">0.7292645</td>
<td align="center">0.0000000</td>
<td align="center">0.7268273</td>
<td align="center">0.7292645</td>
</tr>
</tbody>
</table>

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

2
docs/articles/EUCAST.html

@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
<h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">12 February 2019</h4>
<h4 class="date">14 February 2019</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></div>

8
docs/articles/G_test.html

@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
</a>
</li>
<li>
<a href="../articles/Predict.html">
<a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span>
Predict antimicrobial resistance
@ -91,14 +91,14 @@ @@ -91,14 +91,14 @@
</a>
</li>
<li>
<a href="../articles/mo_property.html">
<a href="../reference/mo_property.html">
<span class="fa fa-bug"></span>
Get properties of a microorganism
</a>
</li>
<li>
<a href="../articles/ab_property.html">
<a href="../reference/atc_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
<h1>How to use the <em>G</em>-test</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">09 February 2019</h4>
<h4 class="date">14 February 2019</h4>
<div class="hidden name"><code>G_test.Rmd</code></div>

54
docs/articles/WHONET.html

@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
</a>
</li>
<li>
<a href="../articles/Predict.html">
<a href="../articles/resistance_predict.html">
<span class="fa fa-dice"></span>
Predict antimicrobial resistance
@ -91,14 +91,14 @@ @@ -91,14 +91,14 @@
</a>
</li>
<li>
<a href="../articles/mo_property.html">
<a href="../reference/mo_property.html">
<span class="fa fa-bug"></span>
Get properties of a microorganism
</a>
</li>
<li>
<a href="../articles/ab_property.html">
<a href="../reference/atc_property.html">
<span class="fa fa-capsules"></span>
Get properties of an antibiotic
@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
<h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">09 February 2019</h4>
<h4 class="date">14 February 2019</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div>
@ -199,33 +199,33 @@ @@ -199,33 +199,33 @@
<a href="#import-of-data" class="anchor"></a>Import of data</h1>
<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>
<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://www.rdocumentation.org/packages/base/topics/library">library</a></span>(readxl)</a>
<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>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(readxl)</a>
<a class="sourceLine" id="cb1-2" title="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>
<p>This package comes with an <a href="./reference/WHONET.html">example data set <code>WHONET</code></a>. We will use it for this analysis.</p>
</div>
<div id="preparation" class="section level1">
<h1 class="hasAnchor">
<a href="#preparation" class="anchor"></a>Preparation</h1>
<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 don’t 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://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></a>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(AMR) <span class="co"># this package</span></a></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr) <span class="co"># part of tidyverse</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(ggplot2) <span class="co"># part of tidyverse</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(AMR) <span class="co"># this package</span></a></code></pre></div>
<p>We will have to transform some variables to simplify and automate the analysis:</p>
<ul>
<li>Microorganisms should be transformed to our own microorganism IDs (called an <code>mo</code>) using <a href="./reference/ITIS.html">the ITIS reference data set</a>, which contains all ~20,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>
</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>
<a class="sourceLine" id="cb3-2" data-line-number="2">data &lt;-<span class="st"> </span>WHONET <span class="op">%&gt;%</span></a>
<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>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="st"> </span><span class="kw"><a