Browse Source

(v0.8.0.9033) antivirals data set, cleanup

main
parent
commit
267320f15f
  1. 4
      DESCRIPTION
  2. 8
      NEWS.md
  3. 41
      R/data.R
  4. 2
      R/eucast_rules.R
  5. 17
      R/mdro.R
  6. 22
      R/mo.R
  7. 2
      R/whocc.R
  8. 52
      _pkgdown.yml
  9. 20
      data-raw/reproduction_of_antibiotics.R
  10. 62
      data-raw/reproduction_of_antivirals.R
  11. BIN
      data/antivirals.rda
  12. BIN
      data/example_isolates.rda
  13. 2
      docs/404.html
  14. 2
      docs/LICENSE-text.html
  15. 416
      docs/articles/AMR.html
  16. BIN
      docs/articles/AMR_files/figure-html/plot 1-1.png
  17. BIN
      docs/articles/AMR_files/figure-html/plot 3-1.png
  18. BIN
      docs/articles/AMR_files/figure-html/plot 4-1.png
  19. BIN
      docs/articles/AMR_files/figure-html/plot 5-1.png
  20. 4
      docs/articles/EUCAST.html
  21. 63
      docs/articles/MDR.html
  22. 4
      docs/articles/SPSS.html
  23. 4
      docs/articles/WHONET.html
  24. 102
      docs/articles/benchmarks.html
  25. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-11-1.png
  26. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-5-1.png
  27. BIN
      docs/articles/benchmarks_files/figure-html/unnamed-chunk-9-1.png
  28. 2
      docs/articles/index.html
  29. 4
      docs/articles/resistance_predict.html
  30. BIN
      docs/articles/resistance_predict_files/figure-html/unnamed-chunk-6-1.png
  31. BIN
      docs/articles/resistance_predict_files/figure-html/unnamed-chunk-7-1.png
  32. 2
      docs/authors.html
  33. 5
      docs/extra.css
  34. 20
      docs/index.html
  35. 18
      docs/news/index.html
  36. 2
      docs/reference/AMR-deprecated.html
  37. 2
      docs/reference/AMR.html
  38. 4
      docs/reference/WHOCC.html
  39. 2
      docs/reference/WHONET.html
  40. 2
      docs/reference/ab_property.html
  41. 2
      docs/reference/age.html
  42. 2
      docs/reference/age_groups.html
  43. 8
      docs/reference/antibiotics.html
  44. 326
      docs/reference/antivirals.html
  45. 4
      docs/reference/as.ab.html
  46. 2
      docs/reference/as.disk.html
  47. 2
      docs/reference/as.mic.html
  48. 2
      docs/reference/as.mo.html
  49. 2
      docs/reference/as.rsi.html
  50. 2
      docs/reference/atc_online.html
  51. 2
      docs/reference/availability.html
  52. 2
      docs/reference/bug_drug_combinations.html
  53. 2
      docs/reference/catalogue_of_life.html
  54. 2
      docs/reference/catalogue_of_life_version.html
  55. 2
      docs/reference/count.html
  56. 6
      docs/reference/eucast_rules.html
  57. 14
      docs/reference/example_isolates.html
  58. 2
      docs/reference/extended-functions.html
  59. 2
      docs/reference/filter_ab_class.html
  60. 2
      docs/reference/first_isolate.html
  61. 2
      docs/reference/g.test.html
  62. 2
      docs/reference/ggplot_rsi.html
  63. 2
      docs/reference/guess_ab_col.html
  64. 176
      docs/reference/index.html
  65. 2
      docs/reference/join.html
  66. 2
      docs/reference/key_antibiotics.html
  67. 2
      docs/reference/kurtosis.html
  68. 2
      docs/reference/like.html
  69. 11
      docs/reference/mdro.html
  70. 2
      docs/reference/microorganisms.codes.html
  71. 2
      docs/reference/microorganisms.html
  72. 2
      docs/reference/microorganisms.old.html
  73. 2
      docs/reference/mo_property.html
  74. 2
      docs/reference/mo_source.html
  75. 2
      docs/reference/p_symbol.html
  76. 2
      docs/reference/proportion.html
  77. 2
      docs/reference/read.4D.html
  78. 2
      docs/reference/reexports.html
  79. 2
      docs/reference/resistance_predict.html
  80. 14
      docs/reference/rsi_translation.html
  81. 2
      docs/reference/skewness.html
  82. 2
      docs/reference/translate.html
  83. 3
      docs/sitemap.xml
  84. 2
      git_premaster.sh
  85. 15
      index.md
  86. 2
      man/WHOCC.Rd
  87. 6
      man/antibiotics.Rd
  88. 46
      man/antivirals.Rd
  89. 2
      man/as.ab.Rd
  90. 2
      man/eucast_rules.Rd
  91. 6
      man/example_isolates.Rd
  92. 7
      man/mdro.Rd
  93. 12
      man/rsi_translation.Rd
  94. 5
      pkgdown/extra.css
  95. 2
      tests/testthat/test-first_isolate.R
  96. 2
      vignettes/AMR.Rmd
  97. 10
      vignettes/MDR.Rmd

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 0.8.0.9032
Date: 2019-11-15
Version: 0.8.0.9033
Date: 2019-11-18
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),

8
NEWS.md

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
# AMR 0.8.0.9032
<small>Last updated: 15-Nov-2019</small>
# AMR 0.8.0.9033
## <small>Last updated: 18-Nov-2019</small>
### Breaking
* Adopted Adeolu *et al.* (2016), [PMID 27620848](https://www.ncbi.nlm.nih.gov/pubmed/27620848) for the `microorganisms` data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like *Morganellaceae* and *Yersiniaceae*). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with `mdro()` will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family.
@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
* Support for a new MDRO guideline: Magiorakos AP, Srinivasan A *et al.* "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).
* This is now the new default guideline for the `mdro()` function
* The new Verbose mode (`mdro(...., verbose = TRUE)`) returns an informative data set where the reason for MDRO determination is given for every isolate, and an list of the resistant antimicrobial agents
* Data set `antivirals`, containing all entries from the ATC J05 group with their DDDs for oral and parenteral treatment
### Changes
* Improvements to algorithm in `as.mo()`:
@ -48,13 +49,14 @@ @@ -48,13 +49,14 @@
* When running `as.rsi()` over a data set, it will now print the guideline that will be used if it is not specified by the user
* Improvements for `eucast_rules()`:
* Fix where *Stenotrophomonas maltophilia* would always become ceftazidime R (following EUCAST v3.1)
* Fix where *Leuconostoc* and *Pediococcus* would not always become glyopeptides R
* Fix where *Leuconostoc* and *Pediococcus* would not always become glycopeptides R
* non-EUCAST rules in `eucast_rules()` are now applied first and not as last anymore. This is to improve the dependency on certain antibiotics for the official EUCAST rules. Please see `?eucast_rules`.
* Fix for interpreting MIC values with `as.rsi()` where the input is `NA`
* Added "imi" and "imp" as allowed abbreviation for Imipenem (IPM)
* Fix for automatically determining columns with antibiotic results in `mdro()` and `eucast_rules()`
* Added ATC codes for ceftaroline, ceftobiprole and faropenem and fixed two typos in the `antibiotics` data set
* More robust way of determining valid MIC values
* Small changed to the `example_isolates` data set to better reflect reality
### Other
* Change dependency on `clean` to `cleaner`, as this package was renamed accordingly upon CRAN request

41
R/data.R

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#' \item{\code{abbr}}{List of abbreviations as used in many countries, also for antibiotic susceptibility testing (AST)}
#' \item{\code{synonyms}}{Synonyms (often trade names) of a drug, as found in PubChem based on their compound ID}
#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment}
#' \item{\code{oral_units}}{Units of \code{ddd_units}}
#' \item{\code{oral_units}}{Units of \code{oral_ddd}}
#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment}
#' \item{\code{iv_units}}{Units of \code{iv_ddd}}
#' }
@ -48,9 +48,28 @@ @@ -48,9 +48,28 @@
#' European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}
#' @inheritSection WHOCC WHOCC
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{microorganisms}}
#' @seealso \code{\link{antivirals}} \code{\link{microorganisms}}
"antibiotics"
#' Data set with ~100 antivirals
#'
#' A data set containing all antivirals, according to the ATC code group 'J05' (Antivirals for systemic use).
#' @format A \code{\link{data.frame}} with 102 observations and 7 variables:
#' \describe{
#' \item{\code{atc}}{ATC code (Anatomical Therapeutic Chemical) as defined by the WHOCC}
#' \item{\code{name}}{Official name as used by WHONET/EARS-Net or the WHO}
#' \item{\code{atc_group}}{Official pharmacological subgroup (3rd level ATC code) as defined by the WHOCC}
#' \item{\code{oral_ddd}}{Defined Daily Dose (DDD), oral treatment}
#' \item{\code{oral_units}}{Units of \code{oral_ddd}}
#' \item{\code{iv_ddd}}{Defined Daily Dose (DDD), parenteral treatment}
#' \item{\code{iv_units}}{Units of \code{iv_ddd}}
#' }
#' @source World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology (WHOCC): \url{https://www.whocc.no/atc_ddd_index/}
#' @inheritSection WHOCC WHOCC
#' @inheritSection AMR Read more on our website!
#' @seealso \code{\link{antibiotics}} \code{\link{microorganisms}}
"antivirals"
#' Data set with ~70,000 microorganisms
#'
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
@ -126,9 +145,9 @@ catalogue_of_life <- list( @@ -126,9 +145,9 @@ catalogue_of_life <- list(
#' @seealso \code{\link{as.mo}} \code{\link{microorganisms}}
"microorganisms.codes"
#' Data set with 2,000 blood culture isolates
#' Data set with 2,000 example isolates
#'
#' An anonymised data set containing 2,000 microbial blood culture isolates with their full antibiograms found 4 different hospitals in the Netherlands, between 2001 and 2017. This \code{data.frame} can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}.
#' A data set containing 2,000 microbial isolates with their full antibiograms. The data set reflects reality and can be used to practice AMR analysis. For examples, please read \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{the tutorial on our website}.
#' @format A \code{\link{data.frame}} with 2,000 observations and 49 variables:
#' \describe{
#' \item{\code{date}}{date of receipt at the laboratory}
@ -138,7 +157,7 @@ catalogue_of_life <- list( @@ -138,7 +157,7 @@ catalogue_of_life <- list(
#' \item{\code{ward_outpatient}}{logical to determine if ward is an outpatient clinic}
#' \item{\code{age}}{age of the patient}
#' \item{\code{gender}}{gender of the patient}
#' \item{\code{patient_id}}{ID of the patient, first 10 characters of an SHA hash containing irretrievable information}
#' \item{\code{patient_id}}{ID of the patient}
#' \item{\code{mo}}{ID of microorganism created with \code{\link{as.mo}}, see also \code{\link{microorganisms}}}
#' \item{\code{PEN:RIF}}{40 different antibiotics with class \code{rsi} (see \code{\link{as.rsi}}); these column names occur in \code{\link{antibiotics}} data set and can be translated with \code{\link{ab_name}}}
#' }
@ -183,17 +202,17 @@ catalogue_of_life <- list( @@ -183,17 +202,17 @@ catalogue_of_life <- list(
#' Data set for RSI interpretation
#'
#' Data set to interpret MIC and disk diffusion to RSI values. Included guidelines are CLSI (2011-2019) and EUCAST (2011-2019). Use \code{\link{as.rsi}} to transform MICs or disks measurements to RSI values.
#' @format A \code{\link{data.frame}} with 11,559 observations and 9 variables:
#' @format A \code{\link{data.frame}} with 13,975 observations and 9 variables:
#' \describe{
#' \item{\code{guideline}}{Name of the guideline}
#' \item{\code{method}}{Either "MIC" or "DISK"}
#' \item{\code{site}}{Body site, e.g. "Oral" or "Respiratory"}
#' \item{\code{mo}}{Microbial ID, see \code{\link{as.mo}}}
#' \item{\code{ab}}{Antibiotic ID, see \code{\link{as.ab}}}
#' \item{\code{ref_tbl}}{Info about where the guideline rule can be found}
#' \item{\code{S_mic}}{Lowest MIC value that leads to "S"}
#' \item{\code{R_mic}}{Highest MIC value that leads to "R"}
#' \item{\code{dose_disk}}{Dose of the used disk diffusion method}
#' \item{\code{S_disk}}{Lowest number of millimeters that leads to "S"}
#' \item{\code{R_disk}}{Highest number of millimeters that leads to "R"}
#' \item{\code{disk_dose}}{Dose of the used disk diffusion method}
#' \item{\code{breakpoint_S}}{Lowest MIC value or highest number of millimeters that leads to "S"}
#' \item{\code{breakpoint_R}}{Highest MIC value or lowest number of millimeters that leads to "R"}
#' }
#' @inheritSection AMR Read more on our website!
"rsi_translation"

2
R/eucast_rules.R

@ -163,6 +163,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" @@ -163,6 +163,7 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' }
#' @inheritSection AMR Read more on our website!
#' @examples
#' \donttest{
#' a <- data.frame(mo = c("Staphylococcus aureus",
#' "Enterococcus faecalis",
#' "Escherichia coli",
@ -198,7 +199,6 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016" @@ -198,7 +199,6 @@ EUCAST_VERSION_EXPERT_RULES <- "3.1, 2016"
#' # 5 Pseudomonas aeruginosa R R - - R R R
#'
#'
#' \donttest{
#' # do not apply EUCAST rules, but rather get a data.frame
#' # with 18 rows, containing all details about the transformations:
#' c <- eucast_rules(a, verbose = TRUE)

17
R/mdro.R

@ -54,29 +54,24 @@ @@ -54,29 +54,24 @@
#' @rdname mdro
#' @aliases MDR XDR PDR BRMO 3MRGN 4MRGN
#' @importFrom dplyr %>% filter_at vars all_vars pull mutate_at
#' @importFrom crayon blue bold italic
#' @importFrom crayon blue bold italic red
#' @importFrom cleaner percentage
#' @export
#' @inheritSection AMR Read more on our website!
#' @source
#' Please see Details for the list of publications used for this function.
#' @examples
#' \donttest{
#' library(dplyr)
#'
#' example_isolates %>%
#' mdro() %>%
#' freq()
#'
#' \donttest{
#' example_isolates %>%
#' mutate(EUCAST = eucast_exceptional_phenotypes(.),
#' BRMO = brmo(.),
#' MRGN = mrgn(.))
#'
#' example_isolates %>%
#' rename(PIP = TZP) %>% # no piperacillin, so take piperacillin/tazobactam
#' mrgn() %>% # check German guideline
#' freq() # check frequencies
#' }
mdro <- function(x,
guideline = NULL,
@ -155,7 +150,7 @@ mdro <- function(x, @@ -155,7 +150,7 @@ mdro <- function(x,
guideline$name <- "Multidrug-resistant, extensively drug-resistant and pandrug-resistant bacteria: an international expert proposal for interim standard definitions for acquired resistance."
guideline$author <- "Magiorakos AP, Srinivasan A, Carey RB, ..., Vatopoulos A, Weber JT, Monnet DL"
guideline$version <- "N/A"
guideline$source <- "Magiorakos et al. (2012) Clinical Microbiology and Infection 18:3. DOI: 10.1111/j.1469-0691.2011.03570.x"
guideline$source <- "Clinical Microbiology and Infection 18:3, 2012. DOI: 10.1111/j.1469-0691.2011.03570.x"
} else if (guideline$code == "eucast") {
guideline$name <- "EUCAST Expert Rules, \"Intrinsic Resistance and Exceptional Phenotypes Tables\""
@ -174,7 +169,7 @@ mdro <- function(x, @@ -174,7 +169,7 @@ mdro <- function(x,
guideline$name <- "Cross-border comparison of the Dutch and German guidelines on multidrug-resistant Gram-negative microorganisms"
guideline$author <- "M\u00fcller J, Voss A, K\u00f6ck R, ..., Kern WV, Wendt C, Friedrich AW"
guideline$version <- "N/A"
guideline$source <- "M\u00fcller et al. (2015) Antimicrobial Resistance and Infection Control 4:7. DOI: 10.1186/s13756-015-0047-6"
guideline$source <- "Antimicrobial Resistance and Infection Control 4:7, 2015. DOI: 10.1186/s13756-015-0047-6"
} else if (guideline$code == "brmo") {
guideline$name <- "WIP-Richtlijn Bijzonder Resistente Micro-organismen (BRMO)"
@ -422,9 +417,9 @@ mdro <- function(x, @@ -422,9 +417,9 @@ mdro <- function(x,
if (info == TRUE) {
if (combine_SI == TRUE) {
cat("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n")
cat(red("\nOnly results with 'R' are considered as resistance. Use `combine_SI = FALSE` to also consider 'I' as resistance.\n"))
} else {
cat("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n")
cat(red("\nResults with 'R' or 'I' are considered as resistance. Use `combine_SI = TRUE` to only consider 'R' as resistance.\n"))
}
cat("\nDetermining multidrug-resistant organisms (MDRO), according to:\n",
bold("Guideline: "), italic(guideline$name), "\n",

22
R/mo.R

@ -572,22 +572,21 @@ exec_as.mo <- function(x, @@ -572,22 +572,21 @@ exec_as.mo <- function(x,
# add start en stop regex
x <- paste0("^", x, "$")
x_withspaces_start_only <- paste0("^", x_withspaces)
x_withspaces_end_only <- paste0(x_withspaces, "$")
x_withspaces_start_end <- paste0("^", x_withspaces, "$")
if (isTRUE(debug)) {
cat(paste0(blue('x'), ' "', x, '"\n'))
cat(paste0(blue('x_species'), ' "', x_species, '"\n'))
cat(paste0(blue('x_withspaces_start_only'), ' "', x_withspaces_start_only, '"\n'))
cat(paste0(blue('x_withspaces_end_only'), ' "', x_withspaces_end_only, '"\n'))
cat(paste0(blue('x_withspaces_start_end'), ' "', x_withspaces_start_end, '"\n'))
cat(paste0(blue('x_backup'), ' "', x_backup, '"\n'))
cat(paste0(blue('x_backup_without_spp'), ' "', x_backup_without_spp, '"\n'))
cat(paste0(blue('x_trimmed'), ' "', x_trimmed, '"\n'))
cat(paste0(blue('x_trimmed_species'), ' "', x_trimmed_species, '"\n'))
cat(paste0(blue('x_trimmed_without_group'), ' "', x_trimmed_without_group, '"\n'))
cat(paste0(blue("x"), ' "', x, '"\n'))
cat(paste0(blue("x_species"), ' "', x_species, '"\n'))
cat(paste0(blue("x_withspaces_start_only"), ' "', x_withspaces_start_only, '"\n'))
cat(paste0(blue("x_withspaces_end_only"), ' "', x_withspaces_end_only, '"\n'))
cat(paste0(blue("x_withspaces_start_end"), ' "', x_withspaces_start_end, '"\n'))
cat(paste0(blue("x_backup"), ' "', x_backup, '"\n'))
cat(paste0(blue("x_backup_without_spp"), ' "', x_backup_without_spp, '"\n'))
cat(paste0(blue("x_trimmed"), ' "', x_trimmed, '"\n'))
cat(paste0(blue("x_trimmed_species"), ' "', x_trimmed_species, '"\n'))
cat(paste0(blue("x_trimmed_without_group"), ' "', x_trimmed_without_group, '"\n'))
}
progress <- progress_estimated(n = length(x), min_time = 3)
@ -1782,6 +1781,7 @@ pillar_shaft.mo <- function(x, ...) { @@ -1782,6 +1781,7 @@ pillar_shaft.mo <- function(x, ...) {
out[is.na(x)] <- pillar::style_na(" NA")
out[x == "UNKNOWN"] <- pillar::style_na(" UNKNOWN")
# make it always fit exactly
pillar::new_pillar_shaft_simple(out, align = "left", width = max(nchar(x)))
}

2
R/whocc.R

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
#' All antimicrobial drugs and their official names, ATC codes, ATC groups and defined daily dose (DDD) are included in this package, using the WHO Collaborating Centre for Drug Statistics Methodology.
#' @section WHOCC:
#' \if{html}{\figure{logo_who.png}{options: height=60px style=margin-bottom:5px} \cr}
#' This package contains \strong{all ~450 antimicrobial drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
#' This package contains \strong{all ~550 antibiotic, antimycotic and antiviral drugs} and their Anatomical Therapeutic Chemical (ATC) codes, ATC groups and Defined Daily Dose (DDD) from the World Health Organization Collaborating Centre for Drug Statistics Methodology (WHOCC, \url{https://www.whocc.no}) and the Pharmaceuticals Community Register of the European Commission (\url{http://ec.europa.eu/health/documents/community-register/html/atc.htm}).
#'
#' These have become the gold standard for international drug utilisation monitoring and research.
#'

52
_pkgdown.yml

@ -83,15 +83,6 @@ navbar: @@ -83,15 +83,6 @@ navbar:
href: "LICENSE-text.html"
reference:
- title: "Background information"
desc: >
Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html)
for more information about how to work with functions in this package.
contents:
- "`AMR`"
- "`catalogue_of_life`"
- "`catalogue_of_life_version`"
- "`WHOCC`"
- title: "Cleaning your data"
desc: >
Functions for cleaning and optimising your data, to be able to add
@ -99,28 +90,28 @@ reference: @@ -99,28 +90,28 @@ reference:
antibiotic interpretations by applying [EUCAST rules](http://www.eucast.org/expert_rules_and_intrinsic_resistance/).
contents:
- starts_with("as.")
- "`mo_source`"
- "`eucast_rules`"
- "`rsi_translation`"
- "`guess_ab_col`"
- "`mo_source`"
- "`read.4D`"
- title: "Adding variables to your data"
- "`rsi_translation`"
- title: "Enhancing your data"
desc: >
Functions to add new data to existing data, like the determination
Functions to add new data to your existing data, such as the determination
of first isolates, multi-drug resistant microorganisms (MDRO), getting
properties of microorganisms or antibiotics and determining the age of
patients or divide ages into age groups.
contents:
- "`ab_property`"
- "`age_groups`"
- "`age`"
- "`atc_online_property`"
- "`first_isolate`"
- "`mdro`"
- "`join`"
- "`key_antibiotics`"
- "`mdro`"
- "`mo_property`"
- "`ab_property`"
- "`age`"
- "`age_groups`"
- "`p_symbol`"
- "`join`"
- "`atc_online_property`"
- title: "Analysing your data"
desc: >
Functions for conducting AMR analysis, like counting isolates, calculating
@ -129,24 +120,34 @@ reference: @@ -129,24 +120,34 @@ reference:
- "`availability`"
- "`bug_drug_combinations`"
- "`count`"
- "`portion`"
- "`filter_ab_class`"
- "`g.test`"
- "`ggplot_rsi`"
- "`kurtosis`"
- "`portion`"
- "`resistance_predict`"
- "`skewness`"
- title: "Included data sets"
desc: >
References for microorganisms and antibiotics, and even a
genuine data set with isolates from septic patients.
Scientifically reliable references for microorganisms and
antibiotics, and example data sets to use for practise.
contents:
- "`antibiotics`"
- "`microorganisms`"
- "`antivirals`"
- "`example_isolates`"
- "`WHONET`"
- "`microorganisms.codes`"
- "`microorganisms.old`"
- "`microorganisms`"
- "`WHONET`"
- title: "Background information"
desc: >
Some pages about our package and its external sources. Be sure to read our [How To's](./../articles/index.html)
for more information about how to work with functions in this package.
contents:
- "`AMR`"
- "`catalogue_of_life`"
- "`catalogue_of_life_version`"
- "`WHOCC`"
- title: Other functions
desc: >
These functions are mostly for internal use, but some of
@ -160,9 +161,10 @@ reference: @@ -160,9 +161,10 @@ reference:
These functions are extensions of functions in other packages.
contents:
- "`extended-functions`"
- "`reexports`"
- title: functions
desc: >
These functions are deprecated, meaning that they still
These functions are deprecated, meaning that they will still
work but show a warning with every use and will be removed
in a future version.
contents:

20
data-raw/reproduction_of_antibiotics.R

@ -1,3 +1,23 @@ @@ -1,3 +1,23 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
library(dplyr)

62
data-raw/reproduction_of_antivirals.R

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitlab.io/AMR. #
# ==================================================================== #
# get all data from the WHOCC website
get_atc_table <- function(atc_group) {
# give as input J0XXX, like atc_group = "J05AB"
downloaded <- read_html(paste0("https://www.whocc.no/atc_ddd_index/?code=", atc_group, "&showdescription=no"))
table_title <- downloaded %>% html_nodes(paste0('a[href="./?code=', atc_group, '"]')) %>% html_text()
table_content <- downloaded %>%
html_nodes("table") %>%
html_table(header = TRUE) %>%
# returns list, so make data.frame out of it
as.data.frame(stringsAsFactors = FALSE) %>%
# select right columns
select(atc = ATC.code, name = Name, ddd = DDD, unit = U, ddd_type = Adm.R) %>%
# fill empty rows
mutate(atc = ifelse(atc == "", lag(atc), atc), name = ifelse(name == "", lag(name), name)) %>%
pivot_wider(names_from = ddd_type, values_from = c(ddd, unit)) %>%
mutate(atc_group = table_title)
if (!"ddd_O" %in% colnames(table_content)) {
table_content <- table_content %>% mutate(ddd_O = NA_real_, unit_O = NA_character_)
}
if (!"ddd_P" %in% colnames(table_content)) {
table_content <- table_content %>% mutate(ddd_P = NA_real_, unit_P = NA_character_)
}
table_content %>% select(atc, name, atc_group,
oral_ddd = ddd_O, oral_units = unit_O,
iv_ddd = ddd_P, iv_units = unit_P)
}
# these are the relevant groups for input: https://www.whocc.no/atc_ddd_index/?code=J05A (J05 only contains J05A)
atc_groups <- c("J05AA", "J05AB", "J05AC", "J05AD", "J05AE", "J05AF", "J05AG", "J05AH", "J05AP", "J05AR", "J05AX")
# get the first
antivirals <- get_atc_table(atc_groups[1])
# bind all others to it
for (i in 2:length(atc_groups)) {
antivirals <- rbind(antivirals, get_atc_table(atc_groups[i]))
}
# arrange on name, untibble it and save
antivirals <- antivirals %>% arrange(name) %>% as.data.frame(stringsAsFactors = FALSE)
usethis::use_data(antivirals, overwrite = TRUE)

BIN
data/antivirals.rda

Binary file not shown.

BIN
data/example_isolates.rda

Binary file not shown.

2
docs/404.html

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

2
docs/LICENSE-text.html

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

416
docs/articles/AMR.html

@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9031</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.8.0.9032</span>
</span>
</div>
@ -187,7 +187,7 @@ @@ -187,7 +187,7 @@
<h1>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">15 November 2019</h4>
<h4 class="date">18 November 2019</h4>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -196,7 +196,7 @@ @@ -196,7 +196,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 15 November 2019.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 18 November 2019.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -212,21 +212,21 @@ @@ -212,21 +212,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2019-11-15</td>
<td align="center">2019-11-18</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2019-11-15</td>
<td align="center">2019-11-18</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2019-11-15</td>
<td align="center">2019-11-18</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -321,8 +321,8 @@ @@ -321,8 +321,8 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2015-09-02</td>
<td align="center">V3</td>
<td align="center">2011-03-27</td>
<td align="center">O9</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
@ -332,59 +332,59 @@ @@ -332,59 +332,59 @@
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2017-06-27</td>
<td align="center">H4</td>
<td align="center">2015-09-08</td>
<td align="center">U5</td>
<td align="center">Hospital C</td>
<td align="center">Escherichia 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">M</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2012-05-31</td>
<td align="center">X3</td>
<td align="center">Hospital B</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">I</td>
<td align="center">2014-09-10</td>
<td align="center">L5</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">M</td>
</tr>
<tr class="even">
<td align="center">2013-06-08</td>
<td align="center">K2</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">2011-07-28</td>
<td align="center">D7</td>
<td align="center">Hospital A</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">S</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2012-02-10</td>
<td align="center">M5</td>
<td align="center">2013-04-12</td>
<td align="center">N6</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia 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">M</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-06-25</td>
<td align="center">N7</td>
<td align="center">Hospital D</td>
<td align="center">2017-03-29</td>
<td align="center">F1</td>
<td align="center">Hospital A</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">S</td>
<td align="center">F</td>
<td align="center">M</td>
</tr>
</tbody>
</table>
@ -406,8 +406,8 @@ @@ -406,8 +406,8 @@
#
# Item Count Percent Cum. Count Cum. Percent
# --- ----- ------- -------- ----------- -------------
# 1 M 10,309 51.55% 10,309 51.55%
# 2 F 9,691 48.46% 20,000 100.00%</code></pre>
# 1 M 10,413 52.06% 10,413 52.06%
# 2 F 9,587 47.94% 20,000 100.00%</code></pre>
<p>So, we can draw at least two conclusions immediately. From a data scientists perspective, the data looks clean: only values <code>M</code> and <code>F</code>. From a researchers perspective: there are slightly more men. Nothing we didn’t already know.</p>
<p>The data is already quite clean, but we still need to transform some variables. The <code>bacteria</code> column now consists of text, and we want to add more variables based on microbial IDs later on. So, we will transform this column to valid IDs. The <code><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate()</a></code> function of the <code>dplyr</code> package makes this really easy:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1">data &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span></a>
@ -422,8 +422,8 @@ @@ -422,8 +422,8 @@
<a class="sourceLine" id="cb14-3" data-line-number="3"><span class="co"># Other rules by this AMR package</span></a>
<a class="sourceLine" id="cb14-4" data-line-number="4"><span class="co"># Non-EUCAST: inherit amoxicillin results for unavailable ampicillin (no changes)</span></a>
<a class="sourceLine" id="cb14-5" data-line-number="5"><span class="co"># Non-EUCAST: inherit ampicillin results for unavailable amoxicillin (no changes)</span></a>
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="co"># Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (3,022 values changed)</span></a>
<a class="sourceLine" id="cb14-7" data-line-number="7"><span class="co"># Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (151 values changed)</span></a>
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="co"># Non-EUCAST: set amoxicillin/clav acid = S where ampicillin = S (2,986 values changed)</span></a>
<a class="sourceLine" id="cb14-7" data-line-number="7"><span class="co"># Non-EUCAST: set ampicillin = R where amoxicillin/clav acid = R (176 values changed)</span></a>
<a class="sourceLine" id="cb14-8" data-line-number="8"><span class="co"># Non-EUCAST: set piperacillin = R where piperacillin/tazobactam = R (no changes)</span></a>
<a class="sourceLine" id="cb14-9" data-line-number="9"><span class="co"># Non-EUCAST: set piperacillin/tazobactam = S where piperacillin = S (no changes)</span></a>
<a class="sourceLine" id="cb14-10" data-line-number="10"><span class="co"># Non-EUCAST: set trimethoprim = R where trimethoprim/sulfa = R (no changes)</span></a>
@ -448,14 +448,14 @@ @@ -448,14 +448,14 @@
<a class="sourceLine" id="cb14-29" data-line-number="29"><span class="co"># Pasteurella multocida (no changes)</span></a>
<a class="sourceLine" id="cb14-30" data-line-number="30"><span class="co"># Staphylococcus (no changes)</span></a>
<a class="sourceLine" id="cb14-31" data-line-number="31"><span class="co"># Streptococcus groups A, B, C, G (no changes)</span></a>
<a class="sourceLine" id="cb14-32" data-line-number="32"><span class="co"># Streptococcus pneumoniae (1,071 values changed)</span></a>
<a class="sourceLine" id="cb14-32" data-line-number="32"><span class="co"># Streptococcus pneumoniae (1,015 values changed)</span></a>
<a class="sourceLine" id="cb14-33" data-line-number="33"><span class="co"># Viridans group streptococci (no changes)</span></a>
<a class="sourceLine" id="cb14-34" data-line-number="34"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-35" data-line-number="35"><span class="co"># EUCAST Expert Rules, Intrinsic Resistance and Exceptional Phenotypes (v3.1, 2016)</span></a>
<a class="sourceLine" id="cb14-36" data-line-number="36"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,282 values changed)</span></a>
<a class="sourceLine" id="cb14-36" data-line-number="36"><span class="co"># Table 01: Intrinsic resistance in Enterobacteriaceae (1,284 values changed)</span></a>
<a class="sourceLine" id="cb14-37" data-line-number="37"><span class="co"># Table 02: Intrinsic resistance in non-fermentative Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-38" data-line-number="38"><span class="co"># Table 03: Intrinsic resistance in other Gram-negative bacteria (no changes)</span></a>
<a class="sourceLine" id="cb14-39" data-line-number="39"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,783 values changed)</span></a>
<a class="sourceLine" id="cb14-39" data-line-number="39"><span class="co"># Table 04: Intrinsic resistance in Gram-positive bacteria (2,796 values changed)</span></a>
<a class="sourceLine" id="cb14-40" data-line-number="40"><span class="co"># Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci (no changes)</span></a>
<a class="sourceLine" id="cb14-41" data-line-number="41"><span class="co"># Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (no changes)</span></a>
<a class="sourceLine" id="cb14-42" data-line-number="42"><span class="co"># Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins (no changes)</span></a>
@ -463,15 +463,15 @@ @@ -463,15 +463,15 @@
<a class="sourceLine" id="cb14-44" data-line-number="44"><span class="co"># Table 13: Interpretive rules for quinolones (no changes)</span></a>
<a class="sourceLine" id="cb14-45" data-line-number="45"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-46" data-line-number="46"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-47" data-line-number="47"><span class="co"># EUCAST rules affected 6,586 out of 20,000 rows, making a total of 8,309 edits</span></a>
<a class="sourceLine" id="cb14-47" data-line-number="47"><span class="co"># EUCAST rules affected 6,569 out of 20,000 rows, making a total of 8,257 edits</span></a>
<a class="sourceLine" id="cb14-48" data-line-number="48"><span class="co"># =&gt; added 0 test results</span></a>
<a class="sourceLine" id="cb14-49" data-line-number="49"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-50" data-line-number="50"><span class="co"># =&gt; changed 8,309 test results</span></a>
<a class="sourceLine" id="cb14-51" data-line-number="51"><span class="co"># - 129 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-52" data-line-number="52"><span class="co"># - 4,834 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-53" data-line-number="53"><span class="co"># - 1,222 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-54" data-line-number="54"><span class="co"># - 324 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-55" data-line-number="55"><span class="co"># - 1,800 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-50" data-line-number="50"><span class="co"># =&gt; changed 8,257 test results</span></a>
<a class="sourceLine" id="cb14-51" data-line-number="51"><span class="co"># - 123 test results changed from S to I</span></a>
<a class="sourceLine" id="cb14-52" data-line-number="52"><span class="co"># - 4,779 test results changed from S to R</span></a>
<a class="sourceLine" id="cb14-53" data-line-number="53"><span class="co"># - 1,134 test results changed from I to S</span></a>
<a class="sourceLine" id="cb14-54" data-line-number="54"><span class="co"># - 369 test results changed from I to R</span></a>
<a class="sourceLine" id="cb14-55" data-line-number="55"><span class="co"># - 1,852 test results changed from R to S</span></a>
<a class="sourceLine" id="cb14-56" data-line-number="56"><span class="co"># --------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb14-57" data-line-number="57"><span class="co"># </span></a>
<a class="sourceLine" id="cb14-58" data-line-number="58"><span class="co"># Use eucast_rules(..., verbose = TRUE) (on your original data) to get a data.frame with all specified edits instead.</span></a></code></pre></div>
@ -499,8 +499,8 @@ @@ -499,8 +499,8 @@
<a class="sourceLine" id="cb16-3" data-line-number="3"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `bacteria` as input for `col_mo`.</span></a>
<a class="sourceLine" id="cb16-4" data-line-number="4"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `date` as input for `col_date`.</span></a>
<a class="sourceLine" id="cb16-5" data-line-number="5"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb16-6" data-line-number="6"><span class="co"># =&gt; Found 5,688 first isolates (28.4% of total)</span></a></code></pre></div>
<p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<a class="sourceLine" id="cb16-6" data-line-number="6"><span class="co"># =&gt; Found 5,699 first isolates (28.5% of total)</span></a></code></pre></div>
<p>So only 28.5% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(first <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>)</a></code></pre></div>
<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>
@ -510,7 +510,7 @@ @@ -510,7 +510,7 @@
<div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor">
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient I9, 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 X7, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -526,19 +526,19 @@ @@ -526,19 +526,19 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-02-08</td>
<td align="center">I9</td>
<td align="center">2010-03-18</td>
<td align="center">X7</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">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-05</td>
<td align="center">I9</td>
<td align="center">2010-04-28</td>
<td align="center">X7</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -548,30 +548,30 @@ @@ -548,30 +548,30 @@
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-05-14</td>
<td align="center">I9</td>
<td align="center">2010-06-26</td>
<td align="center">X7</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">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-12-10</td>
<td align="center">I9</td>
<td align="center">2010-08-06</td>
<td align="center">X7</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>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-12-17</td>
<td align="center">I9</td>
<td align="center">2010-08-31</td>
<td align="center">X7</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -581,19 +581,19 @@ @@ -581,19 +581,19 @@
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-04-18</td>
<td align="center">I9</td>
<td align="center">2010-10-15</td>
<td align="center">X7</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">FALSE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-04-25</td>
<td align="center">I9</td>
<td align="center">2010-11-19</td>
<td align="center">X7</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
@ -603,8 +603,8 @@ @@ -603,8 +603,8 @@
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-06-06</td>
<td align="center">I9</td>
<td align="center">2011-01-20</td>
<td align="center">X7</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -614,23 +614,23 @@ @@ -614,23 +614,23 @@
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-07-14</td>
<td align="center">I9</td>
<td align="center">2011-04-10</td>
<td align="center">X7</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="even">
<td align="center">10</td>
<td align="center">2011-07-31</td>
<td align="center">I9</td>
<td align="center">2011-04-12</td>
<td align="center">X7</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>
</tr>
@ -647,7 +647,7 @@ @@ -647,7 +647,7 @@
<a class="sourceLine" id="cb19-7" data-line-number="7"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `patient_id` as input for `col_patient_id`.</span></a>
<a class="sourceLine" id="cb19-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Using column `keyab` as input for `col_keyantibiotics`. Use col_keyantibiotics = FALSE to prevent this.</span></a>
<a class="sourceLine" id="cb19-9" data-line-number="9"><span class="co"># [Criterion] Inclusion based on key antibiotics, ignoring I</span></a>
<a class="sourceLine" id="cb19-10" data-line-number="10"><span class="co"># =&gt; Found 15,051 first weighted isolates (75.3% of total)</span></a></code></pre></div>
<a class="sourceLine" id="cb19-10" data-line-number="10"><span class="co"># =&gt; Found 15,085 first weighted isolates (75.4% of total)</span></a></code></pre></div>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -664,92 +664,92 @@ @@ -664,92 +664,92 @@
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-02-08</td>
<td align="center">I9</td>
<td align="center">2010-03-18</td>
<td align="center">X7</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">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-03-05</td>
<td align="center">I9</td>
<td align="center">2010-04-28</td>
<td align="center">X7</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">FALSE</td>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-05-14</td>
<td align="center">I9</td>
<td align="center">2010-06-26</td>
<td align="center">X7</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">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-12-10</td>
<td align="center">I9</td>
<td align="center">2010-08-06</td>
<td align="center">X7</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">TRUE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-12-17</td>
<td align="center">I9</td>
<td align="center">2010-08-31</td>
<td align="center">X7</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">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-04-18</td>
<td align="center">I9</td>
<td align="center">2010-10-15</td>
<td align="center">X7</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">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-04-25</td>
<td align="center">I9</td>
<td align="center">2010-11-19</td>
<td align="center">X7</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">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-06-06</td>
<td align="center">I9</td>
<td align="center">2011-01-20</td>
<td align="center">X7</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -760,35 +760,35 @@ @@ -760,35 +760,35 @@
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-07-14</td>
<td align="center">I9</td>
<td align="center">2011-04-10</td>
<td align="center">X7</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>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-07-31</td>
<td align="center">I9</td>
<td align="center">2011-04-12</td>
<td align="center">X7</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">TRUE</td>
<td align="center">FALSE</td>
</tr>
</tbody>
</table>
<p>Instead of 2, now 9 isolates are flagged. In total, 75.3% 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 6 isolates are flagged. In total, 75.4% 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="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb20-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</a></code></pre></div>
<p>So we end up with 15,051 isolates for analysis.</p>
<p>So we end up with 15,085 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1">data_1st &lt;-<span class="st"> </span>data_1st <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(<span class="op">-</span><span class="kw"><a href="https://rdrr.io/r/base/c.html">c</a></span>(first, keyab))</a></code></pre></div>
@ -813,57 +813,25 @@ @@ -813,57 +813,25 @@
</tr></thead>
<tbody>
<tr class="odd">
<td>2</td>
<td align="center">2017-06-27</td>
<td align="center">H4</td>
<td align="center">Hospital C</td>
<td>1</td>
<td align="center">2011-03-27</td>
<td align="center">O9</td>
<td align="center">Hospital B</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">M</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">TRUE</td>
</tr>
<tr class="even">
<td>3</td>
<td align="center">2012-05-31</td>
<td align="center">X3</td>
<td align="center">Hospital B</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">I</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>