Browse Source

(v1.3.0.9015) as.mo() speedup for valid taxonomic names

main
parent
commit
68e9cb78e9
  1. 2
      DESCRIPTION
  2. 4
      NEWS.md
  3. 1
      R/globals.R
  4. 7
      R/mo.R
  5. 6
      R/zzz.R
  6. BIN
      data-raw/antibiotics.dta
  7. BIN
      data-raw/antibiotics.sas
  8. BIN
      data-raw/antibiotics.sav
  9. BIN
      data-raw/antibiotics.xlsx
  10. BIN
      data-raw/antivirals.dta
  11. BIN
      data-raw/antivirals.sas
  12. BIN
      data-raw/antivirals.sav
  13. BIN
      data-raw/antivirals.xlsx
  14. BIN
      data-raw/intrinsic_resistant.dta
  15. BIN
      data-raw/intrinsic_resistant.sas
  16. BIN
      data-raw/intrinsic_resistant.sav
  17. BIN
      data-raw/intrinsic_resistant.xlsx
  18. BIN
      data-raw/microorganisms.dta
  19. BIN
      data-raw/microorganisms.old.dta
  20. BIN
      data-raw/microorganisms.old.sas
  21. BIN
      data-raw/microorganisms.old.sav
  22. BIN
      data-raw/microorganisms.old.xlsx
  23. BIN
      data-raw/microorganisms.sas
  24. BIN
      data-raw/microorganisms.sav
  25. BIN
      data-raw/microorganisms.xlsx
  26. BIN
      data-raw/rsi_translation.dta
  27. BIN
      data-raw/rsi_translation.sas
  28. BIN
      data-raw/rsi_translation.sav
  29. BIN
      data-raw/rsi_translation.xlsx
  30. 2
      docs/404.html
  31. 2
      docs/LICENSE-text.html
  32. 478
      docs/articles/AMR.html
  33. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  34. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  35. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  36. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  37. 4
      docs/articles/EUCAST.html
  38. 68
      docs/articles/MDR.html
  39. 84
      docs/articles/PCA.html
  40. 6
      docs/articles/SPSS.html
  41. 5
      docs/articles/WHONET.html
  42. 116
      docs/articles/benchmarks.html
  43. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-4-1.png
  44. 2
      docs/articles/datasets.html
  45. 2
      docs/articles/index.html
  46. 4
      docs/articles/resistance_predict.html
  47. 4
      docs/articles/welcome_to_AMR.html
  48. 2
      docs/authors.html
  49. 2
      docs/index.html
  50. 8
      docs/news/index.html
  51. 2
      docs/pkgdown.yml
  52. 4
      docs/reference/AMR-deprecated.html
  53. 4
      docs/reference/AMR.html
  54. 4
      docs/reference/WHOCC.html
  55. 2
      docs/reference/WHONET.html
  56. 4
      docs/reference/ab_from_text.html
  57. 2
      docs/reference/ab_property.html
  58. 4
      docs/reference/age.html
  59. 4
      docs/reference/age_groups.html
  60. 4
      docs/reference/antibiotic_class_selectors.html
  61. 4
      docs/reference/antibiotics.html
  62. 2
      docs/reference/as.ab.html
  63. 2
      docs/reference/as.disk.html
  64. 2
      docs/reference/as.mic.html
  65. 2
      docs/reference/as.mo.html
  66. 2
      docs/reference/as.rsi.html
  67. 2
      docs/reference/atc_online.html
  68. 4
      docs/reference/availability.html
  69. 2
      docs/reference/bug_drug_combinations.html
  70. 4
      docs/reference/catalogue_of_life.html
  71. 4
      docs/reference/catalogue_of_life_version.html
  72. 4
      docs/reference/count.html
  73. 4
      docs/reference/eucast_rules.html
  74. 4
      docs/reference/example_isolates.html
  75. 4
      docs/reference/example_isolates_unclean.html
  76. 4
      docs/reference/filter_ab_class.html
  77. 4
      docs/reference/first_isolate.html
  78. 4
      docs/reference/g.test.html
  79. 4
      docs/reference/ggplot_pca.html
  80. 4
      docs/reference/ggplot_rsi.html
  81. 4
      docs/reference/guess_ab_col.html
  82. 2
      docs/reference/index.html
  83. 4
      docs/reference/intrinsic_resistant.html
  84. 4
      docs/reference/join.html
  85. 4
      docs/reference/key_antibiotics.html
  86. 4
      docs/reference/kurtosis.html
  87. 4
      docs/reference/lifecycle.html
  88. 2
      docs/reference/like.html
  89. 4
      docs/reference/mdro.html
  90. 2
      docs/reference/microorganisms.codes.html
  91. 4
      docs/reference/microorganisms.html
  92. 4
      docs/reference/microorganisms.old.html
  93. 2
      docs/reference/mo_property.html
  94. 4
      docs/reference/mo_source.html
  95. 4
      docs/reference/p_symbol.html
  96. 4
      docs/reference/pca.html
  97. 4
      docs/reference/proportion.html
  98. 4
      docs/reference/resistance_predict.html
  99. 4
      docs/reference/rsi_translation.html
  100. 4
      docs/reference/skewness.html
  101. Some files were not shown because too many files have changed in this diff Show More

2
DESCRIPTION

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Package: AMR
Version: 1.3.0.9014
Version: 1.3.0.9015
Date: 2020-09-03
Title: Antimicrobial Resistance Analysis
Authors@R: c(

4
NEWS.md

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
# AMR 1.3.0.9014
## <small>Last updated: 3 September 2020</small>
# AMR 1.3.0.9015
## <small>Last updated: 3 September 2020</small>
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!

1
R/globals.R

@ -40,6 +40,7 @@ globalVariables(c(".rowid", @@ -40,6 +40,7 @@ globalVariables(c(".rowid",
"intrinsic_resistant",
"isolates",
"lang",
"language",
"lookup",
"microorganism",
"microorganisms",

7
R/mo.R

@ -178,6 +178,13 @@ as.mo <- function(x, @@ -178,6 +178,13 @@ as.mo <- function(x,
...) {
check_dataset_integrity()
if (tryCatch(all(tolower(x) %in% MO_lookup$fullname_lower, na.rm = TRUE)
& isFALSE(Becker)
& isFALSE(Lancefield), error = function(e) FALSE)) {
# to improve speed, special case for taxonomically correct full names (case-insensitive)
return(MO_lookup[match(tolower(x), MO_lookup$fullname_lower), "mo", drop = TRUE])
}
# start off with replaced language-specific non-ASCII characters with ASCII characters
x <- parse_and_convert(x)

6
R/zzz.R

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
envir = asNamespace("AMR"))
assign(x = "LANGUAGES_SUPPORTED",
value = sort(c("en", unique(AMR:::translations_file$lang))),
value = sort(c("en", unique(translations_file$lang))),
envir = asNamespace("AMR"))
# support for tibble headers (type_sum) and tibble columns content (pillar_shaft)
@ -50,13 +50,13 @@ @@ -50,13 +50,13 @@
}
.onAttach <- function(...) {
if (!interactive() || stats::runif(1) > 0.1 || isTRUE(as.logical(Sys.getenv("AMR_silentstart", FALSE)))) {
if (!interactive() || stats::runif(1) > 0.1 || isTRUE(as.logical(getOption("AMR_silentstart", FALSE)))) {
return()
}
packageStartupMessage("Thank you for using the AMR package! ",
"If you have a minute, please anonymously fill in this short questionnaire to improve the package and its functionalities:",
"\nhttps://msberends.github.io/AMR/survey.html",
"\n[ prevent his notice with suppressPackageStartupMessages(library(AMR)) or use Sys.setenv(AMR_silentstart = TRUE) ]")
"\n[ prevent his notice with suppressPackageStartupMessages(library(AMR)) or use options(AMR_silentstart = TRUE) ]")
}
create_MO_lookup <- function() {

BIN
data-raw/antibiotics.dta

Binary file not shown.

BIN
data-raw/antibiotics.sas

Binary file not shown.

BIN
data-raw/antibiotics.sav

Binary file not shown.

BIN
data-raw/antibiotics.xlsx

Binary file not shown.

BIN
data-raw/antivirals.dta

Binary file not shown.

BIN
data-raw/antivirals.sas

Binary file not shown.

BIN
data-raw/antivirals.sav

Binary file not shown.

BIN
data-raw/antivirals.xlsx

Binary file not shown.

BIN
data-raw/intrinsic_resistant.dta

Binary file not shown.

BIN
data-raw/intrinsic_resistant.sas

Binary file not shown.

BIN
data-raw/intrinsic_resistant.sav

Binary file not shown.

BIN
data-raw/intrinsic_resistant.xlsx

Binary file not shown.

BIN
data-raw/microorganisms.dta

Binary file not shown.

BIN
data-raw/microorganisms.old.dta

Binary file not shown.

BIN
data-raw/microorganisms.old.sas

Binary file not shown.

BIN
data-raw/microorganisms.old.sav

Binary file not shown.

BIN
data-raw/microorganisms.old.xlsx

Binary file not shown.

BIN
data-raw/microorganisms.sas

Binary file not shown.

BIN
data-raw/microorganisms.sav

Binary file not shown.

BIN
data-raw/microorganisms.xlsx

Binary file not shown.

BIN
data-raw/rsi_translation.dta

Binary file not shown.

BIN
data-raw/rsi_translation.sas

Binary file not shown.

BIN
data-raw/rsi_translation.sav

Binary file not shown.

BIN
data-raw/rsi_translation.xlsx

Binary file not shown.

2
docs/404.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.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.3.0.9014</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9015</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.3.0.9014</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9015</span>
</span>
</div>

478
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.3.0.9006</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9015</span>
</span>
</div>
@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
<a href="../articles/datasets.html">
<span class="fa fa-database"></span>
Download our reference data sets for own use
Data sets for download / own use
</a>
</li>
<li>
@ -193,7 +193,7 @@ @@ -193,7 +193,7 @@
<h1 data-toc-skip>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">21 August 2020</h4>
<h4 class="date">03 September 2020</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -202,7 +202,7 @@ @@ -202,7 +202,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 21 August 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 03 September 2020.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -233,21 +233,21 @@ @@ -233,21 +233,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2020-08-21</td>
<td align="center">2020-09-03</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-08-21</td>
<td align="center">2020-09-03</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-08-21</td>
<td align="center">2020-09-03</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -361,66 +361,66 @@ @@ -361,66 +361,66 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2011-03-20</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">2014-05-29</td>
<td align="center">B4</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2011-12-03</td>
<td align="center">X9</td>
<td align="center">Hospital B</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">2017-04-19</td>
<td align="center">S1</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">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2012-11-11</td>
<td align="center">A5</td>
<td align="center">Hospital D</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">2017-04-21</td>
<td align="center">L3</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2012-09-03</td>
<td align="center">Y3</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">2011-01-19</td>
<td align="center">A7</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2012-11-19</td>
<td align="center">I3</td>
<td align="center">Hospital C</td>
<td align="center">2011-01-24</td>
<td align="center">H10</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2015-06-05</td>
<td align="center">Q7</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">2011-01-31</td>
<td align="center">T9</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -459,16 +459,16 @@ Longest: 1</p> @@ -459,16 +459,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,358</td>
<td align="right">51.79%</td>
<td align="right">10,358</td>
<td align="right">51.79%</td>
<td align="right">10,409</td>
<td align="right">52.05%</td>
<td align="right">10,409</td>
<td align="right">52.05%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,642</td>
<td align="right">48.21%</td>
<td align="right">9,591</td>
<td align="right">47.96%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -518,7 +518,7 @@ Longest: 1</p> @@ -518,7 +518,7 @@ Longest: 1</p>
<span class="co"># NOTE: Using column `date` as input for `col_date`.</span>
<span class="co"># NOTE: Using column `patient_id` as input for `col_patient_id`.</span>
</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>
<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>
<div class="sourceCode" id="cb16"><pre class="downlit">
<span class="kw">data_1st</span> <span class="op">&lt;-</span> <span class="kw">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="kw">first</span> <span class="op">==</span> <span class="fl">TRUE</span>)
@ -532,7 +532,7 @@ Longest: 1</p> @@ -532,7 +532,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 C8, 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 M8, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -548,21 +548,21 @@ Longest: 1</p> @@ -548,21 +548,21 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-13</td>
<td align="center">C8</td>
<td align="center">2010-01-28</td>
<td align="center">M8</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">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-02-19</td>
<td align="center">C8</td>
<td align="center">2010-05-23</td>
<td align="center">M8</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>
@ -570,10 +570,10 @@ Longest: 1</p> @@ -570,10 +570,10 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-03-12</td>
<td align="center">C8</td>
<td align="center">2010-07-11</td>
<td align="center">M8</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>
@ -581,30 +581,30 @@ Longest: 1</p> @@ -581,30 +581,30 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-03-25</td>
<td align="center">C8</td>
<td align="center">2010-10-01</td>
<td align="center">M8</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">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-04-28</td>
<td align="center">C8</td>
<td align="center">2010-12-02</td>
<td align="center">M8</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">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-07-22</td>
<td align="center">C8</td>
<td align="center">2010-12-23</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -614,8 +614,8 @@ Longest: 1</p> @@ -614,8 +614,8 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-05</td>
<td align="center">C8</td>
<td align="center">2011-01-16</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -625,33 +625,33 @@ Longest: 1</p> @@ -625,33 +625,33 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-01-18</td>
<td align="center">C8</td>
<td align="center">2011-03-14</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-05-24</td>
<td align="center">C8</td>
<td align="center">2011-04-02</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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-06-24</td>
<td align="center">C8</td>
<td align="center">2011-04-05</td>
<td align="center">M8</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">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -686,34 +686,34 @@ Longest: 1</p> @@ -686,34 +686,34 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-01-13</td>
<td align="center">C8</td>
<td align="center">2010-01-28</td>
<td align="center">M8</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">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-02-19</td>
<td align="center">C8</td>
<td align="center">2010-05-23</td>
<td align="center">M8</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-03-12</td>
<td align="center">C8</td>
<td align="center">2010-07-11</td>
<td align="center">M8</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>
@ -722,32 +722,32 @@ Longest: 1</p> @@ -722,32 +722,32 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-03-25</td>
<td align="center">C8</td>
<td align="center">2010-10-01</td>
<td align="center">M8</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">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-04-28</td>
<td align="center">C8</td>
<td align="center">2010-12-02</td>
<td align="center">M8</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">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2010-07-22</td>
<td align="center">C8</td>
<td align="center">2010-12-23</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -758,8 +758,8 @@ Longest: 1</p> @@ -758,8 +758,8 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2010-12-05</td>
<td align="center">C8</td>
<td align="center">2011-01-16</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -770,11 +770,11 @@ Longest: 1</p> @@ -770,11 +770,11 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-01-18</td>
<td align="center">C8</td>
<td align="center">2011-03-14</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">TRUE</td>
@ -782,23 +782,23 @@ Longest: 1</p> @@ -782,23 +782,23 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-05-24</td>
<td align="center">C8</td>
<td align="center">2011-04-02</td>
<td align="center">M8</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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">10</td>
<td align="center">2011-06-24</td>
<td align="center">C8</td>
<td align="center">2011-04-05</td>
<td align="center">M8</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">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
@ -806,13 +806,13 @@ Longest: 1</p> @@ -806,13 +806,13 @@ Longest: 1</p>
</tr>
</tbody>
</table>
<p>Instead of 2, now 8 isolates are flagged. In total, 78.4% of all isolates are marked ‘first weighted’ - 50.1% 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.1% of all isolates are marked ‘first weighted’ - 50.5% 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"><pre class="downlit">
<span class="kw">data_1st</span> <span class="op">&lt;-</span> <span class="kw">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()
</pre></div>
<p>So we end up with 15,686 isolates for analysis.</p>
<p>So we end up with 15,813 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><pre class="downlit">
<span class="kw">data_1st</span> <span class="op">&lt;-</span> <span class="kw">data_1st</span> <span class="op">%&gt;%</span>
@ -857,63 +857,63 @@ Longest: 1</p> @@ -857,63 +857,63 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">1</td>
<td align="center">2011-03-20</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="left">2</td>
<td align="center">2017-04-19</td>
<td align="center">S1</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">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">3</td>
<td align="center">2012-11-11</td>
<td align="center">A5</td>
<td align="center">Hospital D</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">2017-04-21</td>
<td align="center">L3</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">4</td>
<td align="center">2012-09-03</td>
<td align="center">Y3</td>
<td align="center">Hospital C</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">2011-01-19</td>
<td align="center">A7</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">S</td>
<td align="center">R</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">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">5</td>
<td align="center">2012-11-19</td>
<td align="center">I3</td>
<td align="center">Hospital C</td>
<td align="center">2011-01-24</td>
<td align="center">H10</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
@ -921,35 +921,35 @@ Longest: 1</p> @@ -921,35 +921,35 @@ Longest: 1</p>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">8</td>
<td align="center">2013-11-06</td>
<td align="center">B1</td>
<td align="center">Hospital B</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="left">6</td>
<td align="center">2011-01-31</td>
<td align="center">T9</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">R</td>
<td align="center">F</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="even">
<td align="left">9</td>
<td align="center">2017-01-21</td>
<td align="center">U3</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="left">7</td>
<td align="center">2012-12-27</td>
<td align="center">Q9</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
</tbody>
@ -975,8 +975,8 @@ Longest: 1</p> @@ -975,8 +975,8 @@ Longest: 1</p>
</pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 15,686<br>
Available: 15,686 (100%, NA: 0 = 0%)<br>
Length: 15,813<br>
Available: 15,813 (100%, NA: 0 = 0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -993,33 +993,33 @@ Longest: 24</p> @@ -993,33 +993,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">7,774</td>
<td align="right">49.56%</td>
<td align="right">7,774</td>
<td align="right">49.56%</td>
<td align="right">7,901</td>
<td align="right">49.97%</td>
<td align="right">7,901</td>
<td align="right">49.97%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">3,952</td>
<td align="right">25.19%</td>
<td align="right">11,726</td>
<td align="right">74.75%</td>
<td align="right">3,946</td>
<td align="right">24.95%</td>
<td align="right">11,847</td>
<td align="right">74.92%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,367</td>
<td align="right">15.09%</td>
<td align="right">14,093</td>
<td align="right">89.84%</td>
<td align="right">2,394</td>
<td align="right">15.14%</td>
<td align="right">14,241</td>
<td align="right">90.06%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,593</td>
<td align="right">10.16%</td>
<td align="right">15,686</td>
<td align="right">1,572</td>
<td align="right">9.94%</td>
<td align="right">15,813</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -1048,50 +1048,50 @@ Longest: 24</p> @@ -1048,50 +1048,50 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">AMX</td>
<td align="center">3685</td>
<td align="center">3774</td>
<td align="center">257</td>
<td align="center">3832</td>
<td align="center">7774</td>
<td align="center">3870</td>
<td align="center">7901</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">AMC</td>
<td align="center">6104</td>
<td align="center">275</td>
<td align="center">1395</td>
<td align="center">7774</td>
<td align="center">6189</td>
<td align="center">306</td>
<td align="center">1406</td>
<td align="center">7901</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">5979</td>
<td align="center">6042</td>
<td align="center">0</td>
<td align="center">1795</td>
<td align="center">7774</td>
<td align="center">1859</td>
<td align="center">7901</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center">GEN</td>
<td align="center">6986</td>
<td align="center">7094</td>
<td align="center">0</td>
<td align="center">788</td>
<td align="center">7774</td>
<td align="center">807</td>
<td align="center">7901</td>
</tr>
<tr class="odd">
<td align="center">K. pneumoniae</td>
<td align="center">AMX</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">1593</td>
<td align="center">1593</td>
<td align="center">1572</td>
<td align="center">1572</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">AMC</td>
<td align="center">1269</td>
<td align="center">57</td>
<td align="center">267</td>
<td align="center">1593</td>
<td align="center">1245</td>
<td align="center">56</td>
<td align="center">271</td>
<td align="center">1572</td>
</tr>
</tbody>
</table>
@ -1116,34 +1116,34 @@ Longest: 24</p> @@ -1116,34 +1116,34 @@ Longest: 24</p>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center">CIP</td>
<td align="center">5979</td>
<td align="center">6042</td>
<td align="center">0</td>
<td align="center">1795</td>
<td align="center">7774</td>
<td align="center">1859</td>
<td align="center">7901</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center">CIP</td>
<td align="center">1213</td>
<td align="center">1182</td>
<td align="center">0</td>
<td align="center">380</td>
<td align="center">1593</td>
<td align="center">390</td>
<td align="center">1572</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center">CIP</td>
<td align="center">3003</td>
<td align="center">2966</td>
<td align="center">0</td>
<td align="center">949</td>
<td align="center">3952</td>
<td align="center">980</td>
<td align="center">3946</td>
</tr>
<tr class="even">
<td align="center">S. pneumoniae</td>
<td align="center">CIP</td>
<td align="center">1820</td>
<td align="center">1834</td>
<td align="center">0</td>
<td align="center">547</td>
<td align="center">2367</td>
<td align="center">560</td>
<td align="center">2394</td>
</tr>
</tbody>
</table>
@ -1156,7 +1156,7 @@ Longest: 24</p> @@ -1156,7 +1156,7 @@ Longest: 24</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="cb28"><pre class="downlit">
<span class="kw">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span>(<span class="kw">AMX</span>)
<span class="co"># [1] 0.5350631</span>
<span class="co"># [1] 0.5330424</span>
</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="cb29"><pre class="downlit">
@ -1173,19 +1173,19 @@ Longest: 24</p> @@ -1173,19 +1173,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5338783</td>
<td align="center">0.5262478</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5368875</td>
<td align="center">0.5401022</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5367068</td>
<td align="center">0.5257556</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5322422</td>
<td align="center">0.5357938</td>
</tr>
</tbody>
</table>
@ -1206,23 +1206,23 @@ Longest: 24</p> @@ -1206,23 +1206,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5338783</td>
<td align="center">4649</td>
<td align="center">0.5262478</td>
<td align="center">4648</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5368875</td>
<td align="center">5571</td>
<td align="center">0.5401022</td>
<td align="center">5673</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5367068</td>
<td align="center">2411</td>
<td align="center">0.5257556</td>
<td align="center">2349</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5322422</td>
<td align="center">3055</td>
<td align="center">0.5357938</td>
<td align="center">3143</td>
</tr>
</tbody>
</table>
@ -1245,27 +1245,27 @@ Longest: 24</p> @@ -1245,27 +1245,27 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.8205557</td>
<td align="center">0.8986365</td>
<td align="center">0.9855930</td>
<td align="center">0.8220478</td>
<td align="center">0.8978610</td>
<td align="center">0.9860777</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8323917</td>
<td align="center">0.8901444</td>
<td align="center">0.9855618</td>
<td align="center">0.8276081</td>
<td align="center">0.9001272</td>
<td align="center">0.9860051</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.8276822</td>
<td align="center">0.9210526</td>
<td align="center">0.9868421</td>
<td align="center">0.8335023</td>
<td align="center">0.9206792</td>
<td align="center">0.9878358</td>