(v1.7.1.9014) rep() for S3 classes

v1.8.2
parent 16b4c74d44
commit ad10693a1a
  1. 4
      DESCRIPTION
  2. 6
      NAMESPACE
  3. 4
      NEWS.md
  4. 9
      R/ab.R
  5. 2
      R/bug_drug_combinations.R
  6. 9
      R/disk.R
  7. 11
      R/mic.R
  8. 32
      R/mo_property.R
  9. 9
      R/rsi.R
  10. BIN
      R/sysdata.rda
  11. BIN
      data-raw/AMR_latest.tar.gz
  12. 22
      data-raw/translations.tsv
  13. 2
      docs/404.html
  14. 2
      docs/LICENSE-text.html
  15. 495
      docs/articles/AMR.html
  16. BIN
      docs/articles/AMR_files/figure-html/disk_plots-1.png
  17. BIN
      docs/articles/AMR_files/figure-html/disk_plots_mo_ab-1.png
  18. BIN
      docs/articles/AMR_files/figure-html/mic_plots-1.png
  19. BIN
      docs/articles/AMR_files/figure-html/mic_plots-2.png
  20. BIN
      docs/articles/AMR_files/figure-html/mic_plots_mo_ab-1.png
  21. BIN
      docs/articles/AMR_files/figure-html/mic_plots_mo_ab-2.png
  22. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  23. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  24. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  25. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  26. 20
      docs/articles/datasets.html
  27. 2
      docs/articles/index.html
  28. 2
      docs/authors.html
  29. 2
      docs/index.html
  30. 12
      docs/news/index.html
  31. 2
      docs/pkgdown.yml
  32. 2
      docs/reference/ab_property.html
  33. 2
      docs/reference/antibiotic_class_selectors.html
  34. 2
      docs/reference/bug_drug_combinations.html
  35. 2
      docs/reference/index.html
  36. 4
      docs/reference/mo_property.html
  37. 2
      docs/survey.html
  38. 2
      man/mo_property.Rd

@ -1,6 +1,6 @@
Package: AMR
Version: 1.7.1.9013
Date: 2021-07-04
Version: 1.7.1.9014
Date: 2021-07-06
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
person(role = c("aut", "cre"),

@ -93,6 +93,7 @@ S3method(exp,mic)
S3method(expm1,mic)
S3method(floor,mic)
S3method(format,bug_drug_combinations)
S3method(format,taxonomic_name)
S3method(gamma,mic)
S3method(hist,mic)
S3method(kurtosis,data.frame)
@ -127,7 +128,12 @@ S3method(print,taxonomic_name)
S3method(prod,mic)
S3method(quantile,mic)
S3method(range,mic)
S3method(rep,ab)
S3method(rep,disk)
S3method(rep,mic)
S3method(rep,mo)
S3method(rep,rsi)
S3method(rep,taxonomic_name)
S3method(round,mic)
S3method(sign,mic)
S3method(signif,mic)

@ -1,5 +1,5 @@
# `AMR` 1.7.1.9013
## <small>Last updated: 4 July 2021</small>
# `AMR` 1.7.1.9014
## <small>Last updated: 6 July 2021</small>
### Changed
* Antibiotic class selectors (see `ab_class()`)

@ -580,6 +580,15 @@ unique.ab <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep ab
#' @export
#' @noRd
rep.ab <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
generalise_antibiotic_name <- function(x) {
x <- toupper(x)
# remove suffices

@ -113,7 +113,7 @@ bug_drug_combinations <- function(x,
data.frame(S = m["S", ], I = m["I", ], R = m["R", ], stringsAsFactors = FALSE)
})
merged <- do.call(rbind, pivot)
out_group <- data.frame(mo = unique_mo[i],
out_group <- data.frame(mo = rep(unique_mo[i], NROW(merged)),
ab = rownames(merged),
S = merged$S,
I = merged$I,

@ -195,6 +195,15 @@ unique.disk <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep disk
#' @export
#' @noRd
rep.disk <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
# will be exported using s3_register() in R/zzz.R
get_skimmers.disk <- function(column) {
skimr::sfl(

@ -320,6 +320,15 @@ unique.mic <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep mic
#' @export
#' @noRd
rep.mic <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
#' @method sort mic
#' @export
#' @noRd
@ -337,7 +346,7 @@ sort.mic <- function(x, decreasing = FALSE, ...) {
#' @export
#' @noRd
hist.mic <- function(x, ...) {
warning_("Use `plot()` or `ggplot()` for optimal plotting of MIC values", call = FALSE)
warning_("Use `plot()` or ggplot2's `autoplot()` for optimal plotting of MIC values", call = FALSE)
hist(log2(x))
}

@ -48,7 +48,7 @@
#'
#' Intrinsic resistance - [mo_is_intrinsic_resistant()] - will be determined based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.2)`. The [mo_is_intrinsic_resistant()] functions can be vectorised over arguments `x` (input for microorganisms) and over `ab` (input for antibiotics).
#'
#' The functions [mo_family()], [mo_genus()], [mo_name()], [mo_fullname()] and [mo_shortname()] are returned with an additional class `taxonomic_name`, which allows italic printing in [tibbles][tibble::tibble()].
#' The functions [mo_family()], [mo_genus()], [mo_name()], [mo_fullname()] and [mo_shortname()] are returned with an additional class `taxonomic_name`, which allows italic printing in [tibbles][tibble::tibble()] and markdown tables such as with [knitr::kable()].
#'
#' All output [will be translated][translate] where possible.
#'
@ -786,9 +786,9 @@ print.taxonomic_name <- function(x, ...) {
as.data.frame.taxonomic_name <- function(x, ...) {
nm <- deparse1(substitute(x))
if (!"nm" %in% names(list(...))) {
as.data.frame(unclass(x), ..., nm = nm)
as.data.frame.vector(x, ..., nm = nm)
} else {
as.data.frame(unclass(x), ...)
as.data.frame.vector(x, ...)
}
}
@ -801,12 +801,27 @@ type_sum.taxonomic_name <- function(x, ...) {
pillar_shaft.taxonomic_name <- function(x, ...) {
out <- format(x)
hits <- tolower(x) %in% MO_lookup$fullname_lower | tolower(gsub("[^a-zA-Z ]", "", x)) %in% c(MO_lookup$g_species)
# grey out the kingdom (part until first "_")
out[hits] <- font_italic(x[hits], collapse = NULL)
out[is.na(x)] <- font_na(out[is.na(x)], collapse = NULL)
create_pillar_column(out, align = "left")
}
#' @method format taxonomic_name
#' @export
#' @noRd
format.taxonomic_name <- function(x, ...) {
# format only in case of markdown knitting
x <- unclass(x)
if (any(as.character(sys.calls()) %like% "(^|:| )kable\\(") ||
tryCatch(!is.null(knitr::opts_knit$get("out.format")), error = function(e) FALSE) ||
tryCatch(isTRUE(getOption('knitr.in.progress')), error = function(e) FALSE)) {
# perhaps this could be extended or better specified in the future?
hits <- tolower(x) %in% MO_lookup$fullname_lower | tolower(gsub("[^a-zA-Z ]", "", x)) %in% c(MO_lookup$g_species)
x[hits] <- paste0("*", x[hits], "*")
}
x
}
#' @method [ taxonomic_name
#' @export
#' @noRd
@ -856,3 +871,12 @@ unique.taxonomic_name <- function(x, incomparables = FALSE, ...) {
attributes(y) <- attributes(x)
y
}
#' @method rep taxonomic_name
#' @export
#' @noRd
rep.taxonomic_name <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}

@ -1054,6 +1054,15 @@ unique.rsi <- function(x, incomparables = FALSE, ...) {
y
}
#' @method rep rsi
#' @export
#' @noRd
rep.rsi <- function(x, ...) {
y <- NextMethod()
attributes(y) <- attributes(x)
y
}
check_reference_data <- function(reference_data) {
if (!identical(reference_data, AMR::rsi_translation)) {
class_rsi <- vapply(FUN.VALUE = character(1), rsi_translation, function(x) paste0("<", class(x), ">", collapse = " and "))

Binary file not shown.

Binary file not shown.

@ -18,17 +18,17 @@ unknown subspecies TRUE TRUE FALSE TRUE unbekannte Unterart onbekende ondersoort
unknown rank TRUE TRUE FALSE TRUE unbekannter Rang onbekende rang rango desconocido grado sconosciuto rang inconnu classificação desconhecido
CoNS FALSE TRUE FALSE TRUE KNS CNS SCN
CoPS FALSE TRUE FALSE TRUE KPS CPS SCP
Gram-negative TRUE TRUE FALSE FALSE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo
Gram-positive TRUE TRUE FALSE FALSE Grampositiv Gram-positief Gram positivo Gram positivo Gram positif Gram positivo
^Bacteria$ TRUE TRUE FALSE FALSE Bakterien Bacteriën Bacterias Batteri Bactéries Bactérias
^Fungi$ TRUE TRUE FALSE FALSE Pilze Schimmels Hongos Funghi Champignons Fungos
^Yeasts$ TRUE TRUE FALSE FALSE Hefen Gisten Levaduras Lieviti Levures Leveduras
^Protozoa$ TRUE TRUE FALSE FALSE Protozoen Protozoën Protozoarios Protozoi Protozoaires Protozoários
biogroup TRUE TRUE FALSE FALSE Biogruppe biogroep biogrupo biogruppo biogroupe biogrupo
biotype TRUE TRUE FALSE FALSE Biotyp biotipo biotipo biótipo
vegetative TRUE TRUE FALSE FALSE vegetativ vegetatief vegetativo vegetativo végétatif vegetativo
([([ ]*?)group TRUE TRUE FALSE FALSE \\1Gruppe \\1groep \\1grupo \\1gruppo \\1groupe \\1grupo
([([ ]*?)Group TRUE TRUE FALSE FALSE \\1Gruppe \\1Groep \\1Grupo \\1Gruppo \\1Groupe \\1Grupo
Gram-negative TRUE TRUE FALSE TRUE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo
Gram-positive TRUE TRUE FALSE TRUE Grampositiv Gram-positief Gram positivo Gram positivo Gram positif Gram positivo
^Bacteria$ TRUE TRUE FALSE TRUE Bakterien Bacteriën Bacterias Batteri Bactéries Bactérias
^Fungi$ TRUE TRUE FALSE TRUE Pilze Schimmels Hongos Funghi Champignons Fungos
^Yeasts$ TRUE TRUE FALSE TRUE Hefen Gisten Levaduras Lieviti Levures Leveduras
^Protozoa$ TRUE TRUE FALSE TRUE Protozoen Protozoën Protozoarios Protozoi Protozoaires Protozoários
biogroup TRUE TRUE FALSE TRUE Biogruppe biogroep biogrupo biogruppo biogroupe biogrupo
biotype TRUE TRUE FALSE TRUE Biotyp biotipo biotipo biótipo
vegetative TRUE TRUE FALSE TRUE vegetativ vegetatief vegetativo vegetativo végétatif vegetativo
([([ ]*?)group TRUE TRUE FALSE TRUE \\1Gruppe \\1groep \\1grupo \\1gruppo \\1groupe \\1grupo
([([ ]*?)Group TRUE TRUE FALSE TRUE \\1Gruppe \\1Groep \\1Grupo \\1Gruppo \\1Groupe \\1Grupo
no .*growth TRUE FALSE FALSE FALSE keine? .*wachstum geen .*groei no .*crecimientonon sem .*crescimento pas .*croissance sem .*crescimento
no|not TRUE FALSE FALSE FALSE keine? geen|niet no|sin sem non sem
Susceptible TRUE FALSE FALSE FALSE Empfindlich Gevoelig Susceptible

1 pattern regular_expr case_sensitive affect_ab_name affect_mo_name de nl es it fr pt
18 unknown rank TRUE TRUE FALSE TRUE unbekannter Rang onbekende rang rango desconocido grado sconosciuto rang inconnu classificação desconhecido
19 CoNS FALSE TRUE FALSE TRUE KNS CNS SCN
20 CoPS FALSE TRUE FALSE TRUE KPS CPS SCP
21 Gram-negative TRUE TRUE FALSE FALSE TRUE Gramnegativ Gram-negatief Gram negativo Gram negativo Gram négatif Gram negativo
22 Gram-positive TRUE TRUE FALSE FALSE TRUE Grampositiv Gram-positief Gram positivo Gram positivo Gram positif Gram positivo
23 ^Bacteria$ TRUE TRUE FALSE FALSE TRUE Bakterien Bacteriën Bacterias Batteri Bactéries Bactérias
24 ^Fungi$ TRUE TRUE FALSE FALSE TRUE Pilze Schimmels Hongos Funghi Champignons Fungos
25 ^Yeasts$ TRUE TRUE FALSE FALSE TRUE Hefen Gisten Levaduras Lieviti Levures Leveduras
26 ^Protozoa$ TRUE TRUE FALSE FALSE TRUE Protozoen Protozoën Protozoarios Protozoi Protozoaires Protozoários
27 biogroup TRUE TRUE FALSE FALSE TRUE Biogruppe biogroep biogrupo biogruppo biogroupe biogrupo
28 biotype TRUE TRUE FALSE FALSE TRUE Biotyp biotipo biotipo biótipo
29 vegetative TRUE TRUE FALSE FALSE TRUE vegetativ vegetatief vegetativo vegetativo végétatif vegetativo
30 ([([ ]*?)group TRUE TRUE FALSE FALSE TRUE \\1Gruppe \\1groep \\1grupo \\1gruppo \\1groupe \\1grupo
31 ([([ ]*?)Group TRUE TRUE FALSE FALSE TRUE \\1Gruppe \\1Groep \\1Grupo \\1Gruppo \\1Groupe \\1Grupo
32 no .*growth TRUE FALSE FALSE FALSE keine? .*wachstum geen .*groei no .*crecimientonon sem .*crescimento pas .*croissance sem .*crescimento
33 no|not TRUE FALSE FALSE FALSE keine? geen|niet no|sin sem non sem
34 Susceptible TRUE FALSE FALSE FALSE Empfindlich Gevoelig Susceptible

@ -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.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9014</span>
</span>
</div>

@ -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.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9014</span>
</span>
</div>

@ -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.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9014</span>
</span>
</div>
@ -193,7 +193,7 @@
<h1 data-toc-skip>How to conduct AMR data analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">04 July 2021</h4>
<h4 class="date">06 July 2021</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 @@
<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 04 July 2021.</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 06 July 2021.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -233,21 +233,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2021-07-04</td>
<td align="center">2021-07-06</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">2021-07-04</td>
<td align="center">2021-07-06</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">2021-07-04</td>
<td align="center">2021-07-06</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -344,32 +344,32 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="center">Hospital A</td>
<td align="center">2016-02-04</td>
<td align="center">V9</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">M</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2011-10-02</td>
<td align="center">S7</td>
<td align="center">Hospital B</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">2014-06-20</td>
<td align="center">Z9</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>
@ -377,9 +377,9 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2016-11-15</td>
<td align="center">U6</td>
<td align="center">Hospital A</td>
<td align="center">2018-01-01</td>
<td align="center">P4</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
<td align="center">S</td>
@ -388,26 +388,26 @@
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2016-12-08</td>
<td align="center">B10</td>
<td align="center">2014-12-14</td>
<td align="center">W2</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">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-05-10</td>
<td align="center">M2</td>
<td align="center">Hospital D</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">2016-07-27</td>
<td align="center">R6</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">F</td>
</tr>
</tbody>
</table>
@ -441,16 +441,16 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,434</td>
<td align="right">52.17%</td>
<td align="right">10,434</td>
<td align="right">52.17%</td>
<td align="right">10,365</td>
<td align="right">51.83%</td>
<td align="right">10,365</td>
<td align="right">51.83%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,566</td>
<td align="right">47.83%</td>
<td align="right">9,635</td>
<td align="right">48.18%</td>
<td align="right">20,000</td>
<td align="right">100.00%</td>
</tr>
@ -505,9 +505,9 @@ Longest: 1</p>
<span class="co"># ℹ Using column 'patient_id' as input for `col_patient_id`.</span>
<span class="co"># Basing inclusion on all antimicrobial results, using a points threshold of</span>
<span class="co"># 2</span>
<span class="co"># =&gt; Found 10,702 first weighted isolates (phenotype-based, 53.5% of total</span>
<span class="co"># =&gt; Found 10,656 first weighted isolates (phenotype-based, 53.3% of total</span>
<span class="co"># where a microbial ID was available)</span></code></pre></div>
<p>So only 53.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>
<p>So only 53.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="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
@ -515,7 +515,7 @@ Longest: 1</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_isolate</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
<p>So we end up with 10,702 isolates for analysis. Now our data looks like:</p>
<p>So we end up with 10,656 isolates for analysis. Now our data looks like:</p>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">data_1st</span><span class="op">)</span></code></pre></div>
<table class="table">
@ -531,7 +531,7 @@ Longest: 1</p>
<col width="3%">
<col width="6%">
<col width="11%">
<col width="12%">
<col width="13%">
<col width="9%">
<col width="5%">
</colgroup>
@ -553,99 +553,99 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="left">1</td>
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="left">2</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</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">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="left">3</td>
<td align="center">2014-06-20</td>
<td align="center">Z9</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">R</td>
<td align="center">M</td>
<td align="center">S</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"><em>Staphylococcus</em></td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="center">2016-12-08</td>
<td align="center">B10</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="left">6</td>
<td align="center">2016-07-27</td>
<td align="center">R6</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Staphylococcus</em></td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">7</td>
<td align="center">2015-04-29</td>
<td align="center">W8</td>
<td align="center">2011-07-24</td>
<td align="center">W2</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">R</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"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">8</td>
<td align="center">2010-06-19</td>
<td align="center">Q5</td>
<td align="left">9</td>
<td align="center">2012-01-12</td>
<td align="center">K9</td>
<td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</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-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">9</td>
<td align="center">2010-08-20</td>
<td align="center">A8</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="left">11</td>
<td align="center">2013-03-11</td>
<td align="center">B6</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center"><em>Klebsiella</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
</tbody>
@ -669,8 +669,8 @@ Longest: 1</p>
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span>, <span class="va">species</span><span class="op">)</span></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: character<br>
Length: 10,702<br>
Available: 10,702 (100.0%, NA: 0 = 0.0%)<br>
Length: 10,656<br>
Available: 10,656 (100.0%, NA: 0 = 0.0%)<br>
Unique: 4</p>
<p>Shortest: 16<br>
Longest: 24</p>
@ -687,33 +687,33 @@ Longest: 24</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Escherichia coli</td>
<td align="right">4,661</td>
<td align="right">43.55%</td>
<td align="right">4,661</td>
<td align="right">43.55%</td>
<td align="right">4,664</td>
<td align="right">43.77%</td>
<td align="right">4,664</td>
<td align="right">43.77%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Staphylococcus aureus</td>
<td align="right">2,697</td>
<td align="right">25.20%</td>
<td align="right">7,358</td>
<td align="right">68.75%</td>
<td align="right">2,730</td>
<td align="right">25.62%</td>
<td align="right">7,394</td>
<td align="right">69.39%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td>
<td align="right">2,145</td>
<td align="right">20.04%</td>
<td align="right">9,503</td>
<td align="right">88.80%</td>
<td align="right">2,093</td>
<td align="right">19.64%</td>
<td align="right">9,487</td>
<td align="right">89.03%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td>
<td align="right">1,199</td>
<td align="right">11.20%</td>
<td align="right">10,702</td>
<td align="right">1,169</td>
<td align="right">10.97%</td>
<td align="right">10,656</td>
<td align="right">100.00%</td>
</tr>
</tbody>
@ -732,14 +732,14 @@ Longest: 24</p>
<col width="9%">
<col width="9%">
<col width="9%">
<col width="11%">
<col width="10%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="3%">
<col width="6%">
<col width="11%">
<col width="11%">
<col width="13%">
<col width="9%">
<col width="5%">
</colgroup>
@ -760,23 +760,38 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-09-28</td>
<td align="center">A1</td>
<td align="center">2011-09-24</td>
<td align="center">D2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</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">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2011-07-24</td>
<td align="center">W2</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-09-28</td>
<td align="center">J9</td>
<tr class="odd">
<td align="center">2011-03-17</td>
<td align="center">D5</td>
<td align="center">Hospital A</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
@ -785,67 +800,52 @@ Longest: 24</p>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2015-04-29</td>
<td align="center">W8</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<tr class="even">
<td align="center">2011-06-13</td>
<td align="center">X10</td>
<td align="center">Hospital D</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">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"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2017-02-20</td>
<td align="center">P2</td>
<td align="center">Hospital C</td>
<tr class="odd">
<td align="center">2010-04-12</td>
<td align="center">Z4</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</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"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2010-09-14</td>
<td align="center">T8</td>
<td align="center">Hospital A</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">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="even">
<td align="center">2011-01-26</td>
<td align="center">K8</td>
<td align="center">2017-02-25</td>
<td align="center">B5</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">I</td>
<td align="center">I</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"><em>Streptococcus</em></td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
@ -868,52 +868,52 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">AMX</td>
<td align="center">2209</td>
<td align="center">123</td>
<td align="center">2329</td>
<td align="center">4661</td>
<td align="center">2180</td>
<td align="center">145</td>
<td align="center">2339</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">AMC</td>
<td align="center">3406</td>
<td align="center">165</td>
<td align="center">1090</td>
<td align="center">4661</td>
<td align="center">3360</td>
<td align="center">176</td>
<td align="center">1128</td>
<td align="center">4664</td>
</tr>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">CIP</td>
<td align="center">3416</td>
<td align="center">3405</td>
<td align="center">0</td>
<td align="center">1245</td>
<td align="center">4661</td>
<td align="center">1259</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">GEN</td>
<td align="center">4086</td>
<td align="center">4078</td>
<td align="center">0</td>
<td align="center">575</td>
<td align="center">4661</td>
<td align="center">586</td>
<td align="center">4664</td>
</tr>
<tr class="odd">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">AMX</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">1199</td>
<td align="center">1199</td>
<td align="center">1169</td>
<td align="center">1169</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">AMC</td>
<td align="center">933</td>
<td align="center">39</td>
<td align="center">227</td>
<td align="center">1199</td>
<td align="center">924</td>
<td align="center">49</td>
<td align="center">196</td>
<td align="center">1169</td>
</tr>
</tbody>
</table>
@ -934,36 +934,36 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">E. coli</td>
<td align="center"><em>E. coli</em></td>
<td align="center">GEN</td>
<td align="center">4086</td>
<td align="center">4078</td>
<td align="center">0</td>
<td align="center">575</td>
<td align="center">4661</td>
<td align="center">586</td>
<td align="center">4664</td>
</tr>
<tr class="even">
<td align="center">K. pneumoniae</td>
<td align="center"><em>K. pneumoniae</em></td>
<td align="center">GEN</td>
<td align="center">1068</td>
<td align="center">1042</td>
<td align="center">0</td>
<td align="center">131</td>
<td align="center">1199</td>
<td align="center">127</td>
<td align="center">1169</td>
</tr>
<tr class="odd">
<td align="center">S. aureus</td>
<td align="center"><em>S. aureus</em></td>
<td align="center">GEN</td>
<td align="center">2407</td>
<td align="center">2440</td>
<td align="center">0</td>
<td align="center">290</td>
<td align="center">2697</td>
<td align="center">2730</td>
</tr>
<tr class="even">
<td align="center">S. pneumoniae</td>
<td align="center"><em>S. pneumoniae</em></td>
<td align="center">GEN</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">2145</td>
<td align="center">2145</td>
<td align="center">2093</td>
<td align="center">2093</td>
</tr>
</tbody>
</table>
@ -977,7 +977,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="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span>
<span class="co"># [1] 0.5418613</span></code></pre></div>
<span class="co"># [1] 0.5442005</span></code></pre></div>
<p>Or can be used in conjunction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span>
@ -991,19 +991,19 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5276730</td>
<td align="center">0.5512301</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5422819</td>
<td align="center">0.5383792</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5609308</td>
<td align="center">0.5587121</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5475970</td>
<td align="center">0.5329877</td>
</tr>
</tbody>
</table>
@ -1022,23 +1022,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="center">Hospital A</td>
<td align="center">0.5276730</td>
<td align="center">3180</td>
<td align="center">0.5512301</td>
<td align="center">3211</td>
</tr>
<tr class="even">
<td align="center">Hospital B</td>
<td align="center">0.5422819</td>
<td align="center">3725</td>
<td align="center">0.5383792</td>
<td align="center">3739</td>
</tr>
<tr class="odd">
<td align="center">Hospital C</td>
<td align="center">0.5609308</td>
<td align="center">1633</td>
<td align="center">0.5587121</td>
<td align="center">1584</td>
</tr>
<tr class="even">
<td align="center">Hospital D</td>
<td align="center">0.5475970</td>
<td align="center">2164</td>
<td align="center">0.5329877</td>
<td align="center">2122</td>
</tr>
</tbody>
</table>
@ -1058,28 +1058,28 @@ Longest: 24</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">Escherichia</td>
<td align="center">0.7661446</td>
<td align="center">0.8766359</td>
<td align="center">0.9759708</td>
<td align="center"><em>Escherichia</em></td>
<td align="center">0.7581475</td>
<td align="center">0.8743568</td>
<td align="center">0.9762007</td>
</tr>
<tr class="even">
<td align="center">Klebsiella</td>
<td align="center">0.8106756</td>
<td align="center">0.8907423</td>
<td align="center">0.9833194</td>
<td align="center"><em>Klebsiella</em></td>
<td align="center">0.8323353</td>
<td align="center">0.8913601</td>
<td align="center">0.9760479</td>
</tr>
<tr class="odd">
<td align="center">Staphylococcus</td>
<td align="center">0.7942158</td>
<td align="center">0.8924731</td>
<td align="center">0.9818317</td>
<td align="center"><em>Staphylococcus</em></td>
<td align="center">0.7945055</td>
<td align="center">0.8937729</td>
<td align="center">0.9831502</td>
</tr>
<tr class="even">
<td align="center">Streptococcus</td>
<td align="center">0.5501166</td>
<td align="center"><em>Streptococcus</em></td>
<td align="center">0.5351171</td>
<td align="center">0.0000000</td>
<td align="center">0.5501166</td>
<td align="center">0.5351171</td>
</tr>
</tbody>
</table>
@ -1104,23 +1104,23 @@ Longest: 24</p>
<tbody>
<tr class="odd">
<td align="left">Hospital A</td>
<td align="right">52.8%</td>
<td align="right">26.0%</td>
<td align="right">55.1%</td>
<td align="right">27.0%</td>
</tr>
<tr class="even">
<td align="left">Hospital B</td>
<td align="right">54.2%</td>
<td align="right">26.5%</td>
<td align="right">53.8%</td>
<td align="right">26.2%</td>
</tr>
<tr class="odd">
<td align="left">Hospital C</td>
<td align="right">56.1%</td>
<td align="right">26.7%</td>
<td align="right">55.9%</td>
<td align="right">27.7%</td>
</tr>
<tr class="even">