Browse Source

(v1.1.0.9014) lose dependencies

new-mo-algorithm
parent
commit
5216d2b520
  1. 4
      DESCRIPTION
  2. 6
      NEWS.md
  3. 3
      R/like.R
  4. 1
      R/mdro.R
  5. 2
      docs/404.html
  6. 2
      docs/LICENSE-text.html
  7. 423
      docs/articles/AMR.html
  8. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  9. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  10. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  11. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  12. 89
      docs/articles/MDR.html
  13. 12
      docs/articles/WHONET.html
  14. 2
      docs/articles/index.html
  15. 2
      docs/authors.html
  16. 2
      docs/index.html
  17. 12
      docs/news/index.html
  18. 2
      docs/pkgdown.yml
  19. 2
      docs/reference/index.html
  20. 6
      docs/reference/like.html
  21. 3
      docs/reference/mdro.html
  22. 3
      man/like.Rd
  23. 1
      man/mdro.Rd
  24. 4
      tests/testthat/test-mdro.R
  25. 19
      vignettes/AMR.Rmd
  26. 3
      vignettes/MDR.Rmd
  27. 3
      vignettes/WHONET.Rmd

4
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.1.0.9013
Version: 1.1.0.9014
Date: 2020-05-19
Title: Antimicrobial Resistance Analysis
Authors@R: c(
@ -38,13 +38,11 @@ Depends: @@ -38,13 +38,11 @@ Depends:
R (>= 3.0.0)
Suggests:
cleaner,
covr,
dplyr,
ggplot2,
knitr,
microbenchmark,
rmarkdown,
rvest,
testthat,
tidyr,
utils

6
NEWS.md

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
# AMR 1.1.0.9013
# AMR 1.1.0.9014
## <small>Last updated: 19-May-2020</small>
### Breaking
* Removed code dependency on **all** R packages that this `AMR` package required: `cleaner`, `crayon`, `data.table`, `dplyr`, `ggplot2`, `knitr`, `microbenchmark`, `pillar`, `R6`, `rlang`, `tidyr` and `vctrs`. This is a major code change, but will probably not be noticeable by most users.
* Removed code dependency on all other R packages: `cleaner`, `crayon`, `data.table`, `dplyr`, `ggplot2`, `knitr`, `microbenchmark`, `pillar`, `R6`, `rlang`, `tidyr` and `vctrs`. This is a major code change, but will probably not be noticeable by most users.
Making this package independent on especially the tidyverse tremendously increases sustainability on the long term, since tidyverse functions change quite often. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.
Negative effects of this change are:
* Function `freq()` that was borrowed from the `cleaner` package was removed. Use `cleaner::freq()`, or run `library("cleaner")` before you use `freq()`.
* Printing values of class `mo` or `ab` in a tibble will no longer be in colour.
* All functions from the `mo_*` family (like `mo_name()` and `mo_gramstain()`) are noticeably slower when running on tens of thousands of rows.
* All functions from the `mo_*` family (like `mo_name()` and `mo_gramstain()`) are noticeably slower when running on hundreds of thousands of rows.
* For developers: classes `mo` and `ab` now both also inherit class `character`, to support any data transformation. This change invalidates code that checks for class length == 1.
### Changed

3
R/like.R

@ -60,8 +60,7 @@ @@ -60,8 +60,7 @@
#' \dontrun{
#' library(dplyr)
#' example_isolates %>%
#' filter(mo_name(mo) %like% "^ent") %>%
#' freq(mo)
#' filter(mo_name(mo) %like% "^ent")
#' }
like <- function(x, pattern, ignore.case = TRUE) {
# set to fixed if no regex found

1
R/mdro.R

@ -68,6 +68,7 @@ @@ -68,6 +68,7 @@
#' @examples
#' \dontrun{
#' library(dplyr)
#' library(cleaner)
#'
#' example_isolates %>%
#' mdro() %>%

2
docs/404.html

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

2
docs/LICENSE-text.html

@ -81,7 +81,7 @@ @@ -81,7 +81,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">1.1.0.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9014</span>
</span>
</div>

423
docs/articles/AMR.html

@ -39,7 +39,7 @@ @@ -39,7 +39,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">1.1.0.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9014</span>
</span>
</div>
@ -186,7 +186,7 @@ @@ -186,7 +186,7 @@
<h1 data-toc-skip>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">18 May 2020</h4>
<h4 class="date">19 May 2020</h4>
<small class="dont-index">Source: <a href="https://gitlab.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -195,7 +195,7 @@ @@ -195,7 +195,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 18 May 2020.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 19 May 2020.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -226,21 +226,21 @@ @@ -226,21 +226,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2020-05-18</td>
<td align="center">2020-05-19</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">2020-05-18</td>
<td align="center">2020-05-19</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">2020-05-18</td>
<td align="center">2020-05-19</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -251,14 +251,15 @@ @@ -251,14 +251,15 @@
<div id="needed-r-packages" class="section level2">
<h2 class="hasAnchor">
<a href="#needed-r-packages" class="anchor"></a>Needed R packages</h2>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by Dr Hadley Wickham. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>Our <code>AMR</code> package depends on these packages and even extends their use and functions.</p>
<p>As with many uses in R, we need some additional packages for AMR analysis. Our package works closely together with the <a href="https://www.tidyverse.org">tidyverse packages</a> <a href="https://dplyr.tidyverse.org/"><code>dplyr</code></a> and <a href="https://ggplot2.tidyverse.org"><code>ggplot2</code></a> by RStudio. The tidyverse tremendously improves the way we conduct data science - it allows for a very natural way of writing syntaxes and creating beautiful plots in R.</p>
<p>We will also use the <code>cleaner</code> package, that can be used for cleaning data and creating frequency tables.</p>
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>)
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">ggplot2</span>)
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">AMR</span>)
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">cleaner</span>)
<span class="co"># (if not yet installed, install with:)</span>
<span class="co"># install.packages(c("dplyr", "ggplot2", "AMR"))</span></pre></body></html></div>
<span class="co"># install.packages(c("dplyr", "ggplot2", "AMR", "cleaner"))</span></pre></body></html></div>
</div>
</div>
<div id="creation-of-data" class="section level1">
@ -335,68 +336,68 @@ @@ -335,68 +336,68 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2013-06-23</td>
<td align="center">V9</td>
<td align="center">Hospital C</td>
<td align="center">2017-01-17</td>
<td align="center">W7</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">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2016-12-25</td>
<td align="center">S10</td>
<td align="center">Hospital D</td>
<td align="center">2017-01-15</td>
<td align="center">S1</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2011-01-27</td>
<td align="center">Z10</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">2014-03-03</td>
<td align="center">F8</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2010-09-14</td>
<td align="center">N1</td>
<td align="center">2013-10-12</td>
<td align="center">K3</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2017-10-31</td>
<td align="center">W1</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">R</td>
<td align="center">2017-07-30</td>
<td align="center">Y4</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2014-03-29</td>
<td align="center">L4</td>
<td align="center">Hospital B</td>
<td align="center">2011-01-18</td>
<td align="center">B4</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
@ -408,9 +409,9 @@ @@ -408,9 +409,9 @@
<div id="cleaning-the-data" class="section level1">
<h1 class="hasAnchor">
<a href="#cleaning-the-data" class="anchor"></a>Cleaning the data</h1>
<p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. It gets automatically installed with the <code>AMR</code> package. For its <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function to create frequency tables, you don’t even need to load it yourself as it is available through the <code>AMR</code> package as well.</p>
<p>We also created a package dedicated to data cleaning and checking, called the <code>cleaner</code> package. It <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function can be used to create frequency tables.</p>
<p>For example, for the <code>gender</code> variable:</p>
<div class="sourceCode" id="cb10"><html><body><pre class="r"><span class="no">data</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">gender</span>) <span class="co"># this would be the same: freq(data$gender)</span></pre></body></html></div>
<div class="sourceCode" id="cb10"><html><body><pre class="r"><span class="no">data</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">gender</span>)</pre></body></html></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 20,000<br>
@ -431,16 +432,16 @@ Longest: 1</p> @@ -431,16 +432,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,293</td>
<td align="right">51.47%</td>
<td align="right">10,293</td>
<td align="right">51.47%</td>
<td align="right">10,336</td>
<td align="right">51.68%</td>
<td align="right">10,336</td>
<td align="right">51.68%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,707</td>
<td align="right">48.54%</td>
<td align="right">9,664</td>
<td align="right">48.32%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -480,7 +481,7 @@ Longest: 1</p> @@ -480,7 +481,7 @@ Longest: 1</p>
<span class="co"># [34mNOTE: Using column `[1mbacteria[22m` as input for `col_mo`.[39m</span>
<span class="co"># [34mNOTE: Using column `[1mdate[22m` as input for `col_date`.[39m</span>
<span class="co"># [34mNOTE: Using column `[1mpatient_id[22m` as input for `col_patient_id`.[39m</span></pre></body></html></div>
<p>So only 28.6% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<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>
<div class="sourceCode" id="cb16"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="no">first</span> <span class="kw">==</span> <span class="fl">TRUE</span>)</pre></body></html></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>
@ -490,7 +491,7 @@ Longest: 1</p> @@ -490,7 +491,7 @@ Longest: 1</p>
<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 N1, 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 T4, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -506,21 +507,21 @@ Longest: 1</p> @@ -506,21 +507,21 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-03-16</td>
<td align="center">N1</td>
<td align="center">2010-02-08</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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-04-19</td>
<td align="center">N1</td>
<td align="center">2010-03-28</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -528,8 +529,8 @@ Longest: 1</p> @@ -528,8 +529,8 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-06-26</td>
<td align="center">N1</td>
<td align="center">2010-06-15</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -539,78 +540,78 @@ Longest: 1</p> @@ -539,78 +540,78 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-07-17</td>
<td align="center">N1</td>
<td align="center">2010-07-21</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-09-14</td>
<td align="center">N1</td>
<td align="center">2011-01-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-09-23</td>
<td align="center">N1</td>
<td align="center">2011-04-24</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-14</td>
<td align="center">N1</td>
<td align="center">2011-06-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</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">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-07-30</td>
<td align="center">N1</td>
<td align="center">2011-06-23</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-08-21</td>
<td align="center">N1</td>
<td align="center">2011-09-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-09-09</td>
<td align="center">N1</td>
<td align="center">2011-10-08</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
@ -642,131 +643,131 @@ Longest: 1</p> @@ -642,131 +643,131 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-03-16</td>
<td align="center">N1</td>
<td align="center">2010-02-08</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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-04-19</td>
<td align="center">N1</td>
<td align="center">2010-03-28</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">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">3</td>
<td align="center">2010-06-26</td>
<td align="center">N1</td>
<td align="center">2010-06-15</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</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-17</td>
<td align="center">N1</td>
<td align="center">2010-07-21</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">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-09-14</td>
<td align="center">N1</td>
<td align="center">2011-01-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-09-23</td>
<td align="center">N1</td>
<td align="center">2011-04-24</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-14</td>
<td align="center">N1</td>
<td align="center">2011-06-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</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">FALSE</td>
<td align="center">R</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">2011-07-30</td>
<td align="center">N1</td>
<td align="center">2011-06-23</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-08-21</td>
<td align="center">N1</td>
<td align="center">2011-09-20</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-09-09</td>
<td align="center">N1</td>
<td align="center">2011-10-08</td>
<td align="center">T4</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Instead of 2, now 4 isolates are flagged. In total, 75.4% of all isolates are marked ‘first weighted’ - 46.8% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>Instead of 2, now 10 isolates are flagged. In total, 75.2% of all isolates are marked ‘first weighted’ - 46.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="cb19"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</pre></body></html></div>
<p>So we end up with 15,085 isolates for analysis.</p>
<p>So we end up with 15,048 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data_1st</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">first</span>, <span class="no">keyab</span>))</pre></body></html></div>
@ -792,9 +793,9 @@ Longest: 1</p> @@ -792,9 +793,9 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td>1</td>
<td align="center">2013-06-23</td>
<td align="center">V9</td>
<td align="center">Hospital C</td>
<td align="center">2017-01-17</td>
<td align="center">W7</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">S</td>
<td align="center">S</td>
@ -808,14 +809,14 @@ Longest: 1</p> @@ -808,14 +809,14 @@ Longest: 1</p>
</tr>
<tr class="even">
<td>2</td>
<td align="center">2016-12-25</td>
<td align="center">S10</td>
<td align="center">Hospital D</td>
<td align="center">2017-01-15</td>
<td align="center">S1</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
@ -824,66 +825,66 @@ Longest: 1</p> @@ -824,66 +825,66 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td>3</td>
<td align="center">2011-01-27</td>
<td align="center">Z10</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">2014-03-03</td>
<td align="center">F8</td>
<td align="center">Hospital D</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<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>4</td>
<td align="center">2010-09-14</td>
<td align="center">N1</td>
<td>5</td>
<td align="center">2017-07-30</td>
<td align="center">Y4</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td>5</td>
<td align="center">2017-10-31</td>
<td align="center">W1</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td>6</td>
<td align="center">2011-01-18</td>
<td align="center">B4</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</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-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</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>7</td>
<td align="center">2010-03-02</td>
<td align="center">W2</td>
<td align="center">2013-05-01</td>
<td align="center">G7</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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">B_STRPT_PNMN</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
</tbody>
@ -905,8 +906,8 @@ Longest: 1</p> @@ -905,8 +906,8 @@ Longest: 1</p>
<div class="sourceCode" id="cb23"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>(<span class="no">genus</span>, <span class="no">species</span>)</pre></body></html></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 15,085<br>
Available: 15,085 (100%, NA: 0 = 0%)<br>
Length: 15,048<br>
Available: 15,048 (100%, NA: 0 = 0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -923,33 +924,33 @@ Longest: 24</p> @@ -923,33 +924,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,418</td>
<td align="right">49.17%</td>
<td align="right">7,418</td>
<td align="right">49.17%</td>
<td align="right">7,376</td>
<td align="right">49.02%</td>
<td align="right">7,376</td>
<td align="right">49.02%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,716</td>
<td align="right">24.63%</td>
<td align="right">11,134</td>
<td align="right">73.81%</td>
<td align="right">3,819</td>
<td align="right">25.38%</td>
<td align="right">11,195</td>
<td align="right">74.40%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,404</td>
<td align="right">15.94%</td>
<td align="right">13,538</td>
<td align="right">89.74%</td>
<td align="right">2,330</td>
<td align="right">15.48%</td>
<td align="right">13,525</td>
<td align="right">89.88%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,547</td>
<td align="right">10.26%</td>
<td align="right">15,085</td>
<td align="right">1,523</td>
<td align="right">10.12%</td>
<td align="right">15,048</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -961,7 +962,7 @@ Longest: 24</p> @@ -961,7 +962,7 @@ Longest: 24</p>
<p>The functions <code><a href="../reference/proportion.html">resistance()</a></code> and <code><a href="../reference/proportion.html">susceptibility()</a></code> can be used to calculate antimicrobial resistance or susceptibility. For more specific analyses, the functions <code><a href="../reference/proportion.html">proportion_S()</a></code>, <code><a href="../reference/proportion.html">proportion_SI()</a></code>, <code><a href="../reference/proportion.html">proportion_I()</a></code>, <code><a href="../reference/proportion.html">proportion_IR()</a></code> and <code><a href="../reference/proportion.html">proportion_R()</a></code> can be used to determine the proportion of a specific antimicrobial outcome.</p>
<p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb24"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="no">AMX</span>)
<span class="co"># [1] 0.4658933</span></pre></body></html></div>
<span class="co"># [1] 0.4628522</span></pre></body></html></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="cb25"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span>(<span class="no">hospital</span>) <span class="kw">%&gt;%</span>
@ -974,19 +975,19 @@ Longest: 24</p> @@ -974,19 +975,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4701310</td>
<td align="center">0.4566180</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4702970</td>
<td align="center">0.4606292</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4575579</td>
<td align="center">0.4775330</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4574359</td>
<td align="center">0.4650083</td>
</tr>
</tbody>
</table>
@ -1004,23 +1005,23 @@ Longest: 24</p> @@ -1004,23 +1005,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.4701310</td>
<td align="center">4503</td>
<td align="center">0.4566180</td>
<td align="center">4518</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.4702970</td>
<td align="center">5454</td>
<td align="center">0.4606292</td>
<td align="center">5245</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.4575579</td>
<td align="center">2203</td>
<td align="center">0.4775330</td>
<td align="center">2270</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.4574359</td>
<td align="center">2925</td>
<td align="center">0.4650083</td>
<td align="center">3015</td>
</tr>
</tbody>
</table>
@ -1040,27 +1041,27 @@ Longest: 24</p> @@ -1040,27 +1041,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.9207334</td>
<td align="center">0.8959288</td>
<td align="center">0.9936641</td>
<td align="center">0.9197397</td>
<td align="center">0.8889642</td>
<td align="center">0.9940347</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.9198449</td>
<td align="center">0.9004525</td>
<td align="center">0.9974144</td>
<td align="center">0.9277741</td>
<td align="center">0.8929744</td>
<td align="center">0.9954038</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.9203445</td>
<td align="center">0.9233046</td>
<td align="center">0.9938105</td>
<td align="center">0.9316575</td>
<td align="center">0.9279916</td>
<td align="center">0.9963341</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.6110649</td>
<td align="center">0.6253219</td>
<td align="center">0.0000000</td>
<td align="center">0.6110649</td>
<td align="center">0.6253219</td>
</tr>
</tbody>
</table>

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 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

89
docs/articles/MDR.html

@ -39,7 +39,7 @@ @@ -39,7 +39,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">1.1.0</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.1.0.9014</span>
</span>
</div>
@ -186,7 +186,7 @@ @@ -186,7 +186,7 @@
<h1 data-toc-skip>How to determine multi-drug resistance (MDR)</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 April 2020</h4>
<h4 class="date">19 May 2020</h4>
<small class="dont-index">Source: <a href="https://gitlab.com/msberends/AMR/blob/master/vignettes/MDR.Rmd"><code>vignettes/MDR.Rmd</code></a></small>
<div class="hidden name"><code>MDR.Rmd</code></div>
@ -209,20 +209,16 @@ @@ -209,20 +209,16 @@
<ul>
<li>
<p><code>guideline = "CMI2012"</code> (default)</p>
<p>Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext">link</a>)</p>
</li>
Magiorakos AP, Srinivasan A <em>et al.</em> “Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance.” Clinical Microbiology and Infection (2012) (<a href="https://www.clinicalmicrobiologyandinfection.com/article/S1198-743X(14)61632-3/fulltext">link</a>)</li>
<li>
<p><code>guideline = "EUCAST"</code></p>
<p>The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf">link</a>)</p>
</li>
The European international guideline - EUCAST Expert Rules Version 3.1 “Intrinsic Resistance and Exceptional Phenotypes Tables” (<a href="http://www.eucast.org/fileadmin/src/media/PDFs/EUCAST_files/Expert_Rules/Expert_rules_intrinsic_exceptional_V3.1.pdf">link</a>)</li>
<li>
<p><code>guideline = "TB"</code></p>
<p>The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/">link</a>)</p>
</li>
The international guideline for multi-drug resistant tuberculosis - World Health Organization “Companion handbook to the WHO guidelines for the programmatic management of drug-resistant tuberculosis” (<a href="https://www.who.int/tb/publications/pmdt_companionhandbook/en/">link</a>)</li>
<li>
<p><code>guideline = "MRGN"</code></p>
<p>The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. (<a href="https://doi.org/10.1186/s13756-015-0047-6">link</a>)</p>
</li>
The German national guideline - Mueller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. (<a href="https://doi.org/10.1186/s13756-015-0047-6">link</a>)</li>
<li>
<p><code>guideline = "BRMO"</code></p>
<p>The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu “WIP-richtlijn BRMO (Bijzonder Resistente Micro-Organismen) [ZKH]” (<a href="https://www.rivm.nl/Documenten_en_publicaties/Professioneel_Praktisch/Richtlijnen/Infectieziekten/WIP_Richtlijnen/WIP_Richtlijnen/Ziekenhuizen/WIP_richtlijn_BRMO_Bijzonder_Resistente_Micro_Organismen_ZKH">link</a>)</p>
@ -234,13 +230,14 @@ @@ -234,13 +230,14 @@
<a href="#examples" class="anchor"></a>Examples</h4>
<p>The <code><a href="../reference/mdro.html">mdro()</a></code> function always returns an ordered <code>factor</code>. For example, the output of the default guideline by Magiorakos <em>et al.</em> returns a <code>factor</code> with levels ‘Negative’, ‘MDR’, ‘XDR’ or ‘PDR’ in that order.</p>
<p>The next example uses the <code>example_isolates</code> data set. This is a data set included with this package and contains 2,000 microbial isolates with their full antibiograms. It reflects reality and can be used to practice AMR analysis. If we test the MDR/XDR/PDR guideline on this data set, we get:</p>
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>) <span class="co"># to support pipes: %&gt;%</span></pre></body></html></div>
<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">dplyr</span>) <span class="co"># to support pipes: %&gt;%</span>
<span class="fu"><a href="https://rdrr.io/r/base/library.html">library</a></span>(<span class="no">cleaner</span>) <span class="co"># to create frequency tables</span></pre></body></html></div>
<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">example_isolates</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="../reference/mdro.html">mdro</a></span>() <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span>() <span class="co"># show frequency table of the result</span>
<span class="co"># NOTE: Using column `mo` as input for `col_mo`.</span>
<span class="co"># NOTE: Auto-guessing columns suitable for analysis...OK.</span>
<span class="co"># NOTE: Reliability will be improved if these antimicrobial results would be available too: SAM (ampicillin/sulbactam), ATM (aztreonam), CTT (cefotetan), CPT (ceftaroline), DAP (daptomycin), DOR (doripenem), ETP (ertapenem), FUS (fusidic acid), GEH (gentamicin-high), LVX (levofloxacin), MNO (minocycline), NET (netilmicin), PLB (polymyxin B), QDA (quinupristin/dalfopristin), STH (streptomycin-high), TLV (telavancin), TCC (ticarcillin/clavulanic acid)</span>
<span class="co"># [34mNOTE: Using column `[1mmo[22m` as input for `col_mo`.[39m</span>
<span class="co"># [34mNOTE: Auto-guessing columns suitable for analysis...[39m[34mOK.[39m</span>
<span class="co"># [34mNOTE: Reliability would be improved if these antimicrobial results would be available too: ceftaroline ([1mCPT[22m), fusidic acid ([1mFUS[22m), telavancin ([1mTLV[22m), daptomycin ([1mDAP[22m), quinupristin/dalfopristin ([1mQDA[22m), minocycline ([1mMNO[22m), gentamicin-high ([1mGEH[22m), streptomycin-high ([1mSTH[22m), doripenem ([1mDOR[22m), levofloxacin ([1mLVX[22m), netilmicin ([1mNET[22m), ticarcillin/clavulanic acid ([1mTCC[22m), ertapenem ([1mETP[22m), cefotetan ([1mCTT[22m), aztreonam ([1mATM[22m), ampicillin/sulbactam ([1mSAM[22m), polymyxin B ([1mPLB[22m)[39m</span>
<span class="co"># Warning in mdro(.): NA introduced for isolates where the available percentage of</span>
<span class="co"># antimicrobial classes was below 50% (set with `pct_required_classes`)</span></pre></body></html></div>
<p><strong>Frequency table</strong></p>
@ -281,7 +278,7 @@ Unique: 2</p> @@ -281,7 +278,7 @@ Unique: 2</p>
<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="co"># a helper function to get a random vector with values S, I and R</span>
<span class="co"># with the probabilities 50% - 10% - 40%</span>
<span class="no">sample_rsi</span> <span class="kw">&lt;-</span> <span class="kw">function</span>() {
<span class="fu"><a href="https://rdrr.io/r/base/sample.html">sample</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/sample.html">sample</a></span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"S"</span>, <span class="st">"I"</span>, <span class="st">"R"</span>),
<span class="kw">size</span> <span class="kw">=</span> <span class="fl">5000</span>,
<span class="kw">prob</span> <span class="kw">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="fl">0.5</span>, <span class="fl">0.1</span>, <span class="fl">0.4</span>),
<span class="kw">replace</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
@ -305,26 +302,26 @@ Unique: 2</p> @@ -305,26 +302,26 @@ Unique: 2</p>
<p>The data set now looks like this:</p>
<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="no">my_TB_data</span>)
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
<span class="co"># 1 S I R R S I</span>
<span class="co"># 2 R S S R S S</span>
<span class="co"># 3 R S S R R I</span>
<span class="co"># 4 I S S R R S</span>
<span class="co"># 5 R R S R I R</span>
<span class="co"># 6 R I S I R S</span>