Browse Source

(v1.2.0.9037) survey on website

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

1
.github/workflows/codecovr.yaml

@ -22,7 +22,6 @@ @@ -22,7 +22,6 @@
on:
push:
branches:
- premaster
- master
pull_request:
branches:

4
DESCRIPTION

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Package: AMR
Version: 1.2.0.9036
Date: 2020-07-22
Version: 1.2.0.9037
Date: 2020-07-28
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(role = c("aut", "cre"),

12
NEWS.md

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
# AMR 1.2.0.9036
## <small>Last updated: 22 July 2020</small>
# AMR 1.2.0.9037
## <small>Last updated: 28 July 2020</small>
### New
* Function `ab_from_text()` to retrieve antimicrobial drug names, doses and forms of administration from clinical texts in e.g. health care records, which also corrects for misspelling since it uses `as.ab()` internally
* [Tidyverse selections](https://tidyselect.r-lib.org/reference/language.html) for antibiotic classes, that help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. They can be used in any function that allows Tidyverse selections, like `dplyr::select()` and `tidyr::pivot_longer()`:
* [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html) for antibiotic classes, that help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. They can be used in any function that allows selection helpers, like `dplyr::select()` and `tidyr::pivot_longer()`:
```r
library(dplyr)
@ -33,13 +33,17 @@ @@ -33,13 +33,17 @@
* The `as.ab()` function will now throw a note if more than 1 antimicrobial drug could be retrieved from a single input value.
* Fixed a bug where `eucast_rules()` would not work on a tibble when the `tibble` or `dplyr` package was loaded
* All `*_join_microorganisms()` functions and `bug_drug_combinations()` now return the original data class (e.g. `tibble`s and `data.table`s)
* Fixed a bug for using grouped versions of `rsi_df()`, `proportion_df()` and `count_df()`, and fixed a bug where not all different antimicrobial results were added as rows
* For functions `rsi_df()`, `proportion_df()` and `count_df()`:
* Fixed a bug for using grouped versions
* Fixed a bug where not all different antimicrobial results were added as rows
* Fixed a bug when only calculating counts (`count_df()`) when all antibiotics in the data set have only `NA`s
* Improved auto-determination for columns of types `<mo>` and `<Date>`
* Fixed a bug in `bug_drug_combinations()` for when only one antibiotic was in the input data
* Changed the summary for class `<rsi>`, to highlight the %SI vs. %R
* Improved error handling, giving more useful info when functions return an error
* Any progress bar will now only show in interactive mode (i.e. not in R Markdown)
* Speed improvement for `mdro()` and `filter_ab_class()`
* New option `arrows_textangled` for `ggplot_pca()` to indicate whether the text at the end of the arrows should be angled (defaults to `TRUE`, as it was in previous versions)
### Other
* Moved primary location of this project from GitLab to [GitHub](https://github.com/msberends/AMR), giving us native support for automated syntax checking without being dependent on external services such as AppVeyor and Travis CI.

16
R/aa_helper_functions.R

@ -72,6 +72,15 @@ addin_insert_like <- function() { @@ -72,6 +72,15 @@ addin_insert_like <- function() {
}
check_dataset_integrity <- function() {
# check if user overwrote our data sets in their global environment
data_in_pkg <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item", drop = TRUE]
data_in_globalenv <- ls(envir = globalenv())
overwritten <- data_in_pkg[data_in_pkg %in% data_in_globalenv]
stop_if(length(overwritten) > 0,
"the following data set is overwritten by your global environment and prevents the AMR package from working correctly:\n",
paste0("'", overwritten, "'", collapse = ", "),
".\nPlease rename your object before using this function.", call = FALSE)
# check if other packages did not overwrite our data sets
tryCatch({
check_microorganisms <- all(c("mo", "fullname", "kingdom", "phylum",
"class", "order", "family", "genus",
@ -86,13 +95,6 @@ check_dataset_integrity <- function() { @@ -86,13 +95,6 @@ check_dataset_integrity <- function() {
}, error = function(e)
stop_('please use the command \'library("AMR")\' before using this function, to load the required reference data.', call = FALSE)
)
data_in_pkg <- data(package = "AMR", envir = asNamespace("AMR"))$results[, "Item"]
data_in_globalenv <- ls(envir = globalenv())
overwritten <- data_in_pkg[data_in_pkg %in% data_in_globalenv]
stop_if(length(overwritten) > 0,
"the following data set is overwritten by your global environment and prevents the AMR package from working correctly:\n",
paste0("'", overwritten, "'", collapse = ", "),
".\nPlease rename your object before using this function.", call = FALSE)
invisible(TRUE)
}

21
R/amr.R

@ -23,12 +23,14 @@ @@ -23,12 +23,14 @@
#'
#' Welcome to the `AMR` package.
#' @details
#' `AMR` is a free and open-source R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial properties by using evidence-based methods. It supports any table format, including WHONET/EARS-Net data.
#'
#' We created this package for both academic research and routine analysis at the Faculty of Medical Sciences of the University of Groningen and the Medical Microbiology & Infection Prevention (MMBI) department of the University Medical Center Groningen (UMCG). This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
#' `AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
#'
#' After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
#'
#' This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
#'
#' This package can be used for:
#' - Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the [Catalogue of Life](http://www.catalogueoflife.org)
#' - Reference for the taxonomy of microorganisms, since the package contains all microbial (sub)species from the Catalogue of Life and List of Prokaryotic names with Standing in Nomenclature
#' - Interpreting raw MIC and disk diffusion values, based on the latest CLSI or EUCAST guidelines
#' - Retrieving antimicrobial drug names, doses and forms of administration from clinical health care records
#' - Determining first isolates to be used for AMR analysis
@ -37,15 +39,16 @@ @@ -37,15 +39,16 @@
#' - Calculating (empirical) susceptibility of both mono therapy and combination therapies
#' - Predicting future antimicrobial resistance using regression models
#' - Getting properties for any microorganism (like Gram stain, species, genus or family)
#' - Getting properties for any antibiotic (like name, EARS-Net code, ATC code, PubChem code, defined daily dose or trade name)
#' - Getting properties for any antibiotic (like name, code of EARS-Net/ATC/LOINC/PubChem, defined daily dose or trade name)
#' - Plotting antimicrobial resistance
#' - Getting SNOMED codes of a microorganism, or get its name associated with a SNOMED code
#' - Getting LOINC codes of an antibiotic, or get its name associated with a LOINC code
#' - Applying EUCAST expert rules
#' - Getting SNOMED codes of a microorganism, or getting properties of a microorganism based on a SNOMED code
#' - Getting LOINC codes of an antibiotic, or getting properties of an antibiotic based on a LOINC code
#' - Machine reading the EUCAST and CLSI guidelines from 2011-2020 to translate MIC values and disk diffusion diameters to R/SI
#' - Principal component analysis for AMR
#'
#' @section Read more on our website!:
#' On our website <https://msberends.github.io/AMR> you can find [a comprehensive tutorial](https://msberends.github.io/AMR/articles/AMR.html) about how to conduct AMR analysis, the [complete documentation of all functions](https://msberends.github.io/AMR/reference) (which reads a lot easier than here in R) and [an example analysis using WHONET data](https://msberends.github.io/AMR/articles/WHONET.html).
#' On our website <https://msberends.github.io/AMR> you can find [a comprehensive tutorial](https://msberends.github.io/AMR/articles/AMR.html) about how to conduct AMR analysis, the [complete documentation of all functions](https://msberends.github.io/AMR/reference) (which reads a lot easier than here in R) and [an example analysis using WHONET data](https://msberends.github.io/AMR/articles/WHONET.html). As we would like to better understand the backgrounds and needs of our users, please [participate in our survey](https://msberends.github.io/AMR/survey.html)!
#' @section Contact Us:
#' For suggestions, comments or questions, please contact us at:
#'

9
R/filter_ab_class.R

@ -33,8 +33,7 @@ @@ -33,8 +33,7 @@
#' @seealso [antibiotic_class_selectors()] for the `select()` equivalent.
#' @export
#' @examples
#' \dontrun{
#' library(dplyr)
#' if (require(dplyr)) {
#'
#' # filter on isolates that have any result for any aminoglycoside
#' example_isolates %>% filter_ab_class("aminoglycoside")
@ -64,6 +63,12 @@ @@ -64,6 +63,12 @@
#' filter_aminoglycosides("R", "all") %>%
#' filter_fluoroquinolones("R", "all")
#' }
#'
#' \dontrun{
#' # with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:
#' example_isolates %>% filter_carbapenems("R", "all")
#' example_isolates %>% filter(across(carbapenems(), ~. == "R"))
#' }
filter_ab_class <- function(x,
ab_class,
result = NULL,

72
R/ggplot_pca.R

@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#' @param arrows_colour the colour of the arrow and their text
#' @param arrows_size the size (thickness) of the arrow lines
#' @param arrows_textsize the size of the text at the end of the arrows
#' @param arrows_textangled a logical whether the text at the end of the arrows should be angled
#' @param arrows_alpha the alpha (transparency) of the arrows and their text
#' @param base_textsize the text size for all plot elements except the labels and arrows
#' @param ... Parameters passed on to functions
@ -58,20 +59,25 @@ @@ -58,20 +59,25 @@
#' # `example_isolates` is a dataset available in the AMR package.
#' # See ?example_isolates.
#'
#' \dontrun{
#' # See ?pca for more info about Principal Component Analysis (PCA).
#' library(dplyr)
#' pca_model <- example_isolates %>%
#' filter(mo_genus(mo) == "Staphylococcus") %>%
#' group_by(species = mo_shortname(mo)) %>%
#' summarise_if (is.rsi, resistance) %>%
#' pca(FLC, AMC, CXM, GEN, TOB, TMP, SXT, CIP, TEC, TCY, ERY)
#' if (require("dplyr")) {
#' pca_model <- example_isolates %>%
#' filter(mo_genus(mo) == "Staphylococcus") %>%
#' group_by(species = mo_shortname(mo)) %>%
#' summarise_if (is.rsi, resistance) %>%
#' pca(FLC, AMC, CXM, GEN, TOB, TMP, SXT, CIP, TEC, TCY, ERY)
#'
#' # old (base R)
#' biplot(pca_model)
#'
#' # old
#' biplot(pca_model)
#'
#' # new
#' ggplot_pca(pca_model)
#' # new
#' ggplot_pca(pca_model)
#'
#' if (require("ggplot2")) {
#' ggplot_pca(pca_model) +
#' scale_colour_viridis_d() +
#' labs(title = "Title here")
#' }
#' }
ggplot_pca <- function(x,
choices = 1:2,
@ -91,26 +97,28 @@ ggplot_pca <- function(x, @@ -91,26 +97,28 @@ ggplot_pca <- function(x,
arrows_colour = "darkblue",
arrows_size = 0.5,
arrows_textsize = 3,
arrows_textangled = TRUE,
arrows_alpha = 0.75,
base_textsize = 10,
...) {
stop_ifnot_installed("ggplot2")
stop_ifnot(length(choices) == 2, "`choices` must be of length 2")
stop_ifnot(is.logical(scale), "`scale` must be TRUE or FALSE")
stop_ifnot(is.logical(pc.biplot), "`pc.biplot` must be TRUE or FALSE")
stop_ifnot(is.numeric(choices), "`choices` must be numeric")
stop_ifnot(is.numeric(labels_textsize), "`labels_textsize` must be numeric")
stop_ifnot(is.numeric(labels_text_placement), "`labels_text_placement` must be numeric")
stop_ifnot(is.logical(ellipse), "`ellipse` must be TRUE or FALSE")
stop_ifnot(is.numeric(ellipse_prob), "`ellipse_prob` must be numeric")
stop_ifnot(is.numeric(ellipse_size), "`ellipse_size` must be numeric")
stop_ifnot(is.numeric(ellipse_alpha), "`ellipse_alpha` must be numeric")
stop_ifnot(is.logical(arrows), "`arrows` must be TRUE or FALSE")
stop_ifnot(is.logical(arrows_textangled), "`arrows_textangled` must be TRUE or FALSE")
stop_ifnot(is.logical(ellipse), "`ellipse` must be TRUE or FALSE")
stop_ifnot(is.logical(pc.biplot), "`pc.biplot` must be TRUE or FALSE")
stop_ifnot(is.logical(scale), "`scale` must be TRUE or FALSE")
stop_ifnot(is.numeric(arrows_alpha), "`arrows_alpha` must be numeric")
stop_ifnot(is.numeric(arrows_size), "`arrows_size` must be numeric")
stop_ifnot(is.numeric(arrows_textsize), "`arrows_textsize` must be numeric")
stop_ifnot(is.numeric(arrows_alpha), "`arrows_alpha` must be numeric")
stop_ifnot(is.numeric(base_textsize), "`base_textsize` must be numeric")
stop_ifnot(is.numeric(choices), "`choices` must be numeric")
stop_ifnot(is.numeric(ellipse_alpha), "`ellipse_alpha` must be numeric")
stop_ifnot(is.numeric(ellipse_prob), "`ellipse_prob` must be numeric")
stop_ifnot(is.numeric(ellipse_size), "`ellipse_size` must be numeric")
stop_ifnot(is.numeric(labels_text_placement), "`labels_text_placement` must be numeric")
stop_ifnot(is.numeric(labels_textsize), "`labels_textsize` must be numeric")
calculations <- pca_calculations(pca_model = x,
groups = groups,
@ -206,12 +214,20 @@ ggplot_pca <- function(x, @@ -206,12 +214,20 @@ ggplot_pca <- function(x,
type = "open"),
colour = arrows_colour,
size = arrows_size,
alpha = arrows_alpha) +
ggplot2::geom_text(data = df.v,
ggplot2::aes(label = varname, x = xvar, y = yvar, angle = angle, hjust = hjust),
colour = arrows_colour,
size = arrows_textsize,
alpha = arrows_alpha)
alpha = arrows_alpha)
if (arrows_textangled == TRUE) {
g <- g + ggplot2::geom_text(data = df.v,
ggplot2::aes(label = varname, x = xvar, y = yvar, angle = angle, hjust = hjust),
colour = arrows_colour,
size = arrows_textsize,
alpha = arrows_alpha)
} else {
g <- g + ggplot2::geom_text(data = df.v,
ggplot2::aes(label = varname, x = xvar, y = yvar, hjust = hjust),
colour = arrows_colour,
size = arrows_textsize,
alpha = arrows_alpha)
}
}
# Add caption label about total explained variance

2
R/rsi.R

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
#'
#' Supported guidelines to be used as input for the `guideline` parameter are: `r paste0('"', sort(unique(AMR::rsi_translation$guideline)), '"', collapse = ", ")`. Simply using `"CLSI"` or `"EUCAST"` for input will automatically select the latest version of that guideline.
#'
#' The repository of this package [contains a machine readable version](https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt) of all guidelines. This is a CSV file consisting of `r format(nrow(AMR::rsi_translation), big.mark = ",")` rows and `r ncol(AMR::rsi_translation)` columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. This **allows for easy implementation of these rules in laboratory information systems (LIS)**.
#' The repository of this package [contains a machine readable version](https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt) of all guidelines. This is a CSV file consisting of `r format(nrow(AMR::rsi_translation), big.mark = ",")` rows and `r ncol(AMR::rsi_translation)` columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. **This allows for easy implementation of these rules in laboratory information systems (LIS)**.
#'
#' After using [as.rsi()], you can use [eucast_rules()] to (1) apply inferred susceptibility and resistance based on results of other antimicrobials and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
#'

2
R/rsi_calc.R

@ -214,7 +214,7 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both" @@ -214,7 +214,7 @@ rsi_calc_df <- function(type, # "proportion", "count" or "both"
out <- data.frame(antibiotic = character(0),
interpretation = character(0),
value = double(0),
isolates <- integer(0),
isolates = integer(0),
stringsAsFactors = FALSE)
if (data_has_groups) {
group_values <- unique(.data[, which(colnames(.data) %in% groups), drop = FALSE])

BIN
R/sysdata.rda

Binary file not shown.

8
README.md

@ -3,7 +3,13 @@ @@ -3,7 +3,13 @@
# `AMR` (for R)
<img src="https://msberends.github.io/AMR/works_great_on.png" align="center" height="150px" />
This is the development source of the `AMR` package for R. Not a developer? Then please visit our website [https://msberends.github.io/AMR](https://msberends.github.io/AMR) to read about this package.
`AMR` is a free, open-source and independent R package to simplify the analysis and prediction of Antimicrobial Resistance (AMR) and to work with microbial and antimicrobial data and properties, by using evidence-based methods. Our aim is to provide a standard for clean and reproducible antimicrobial resistance data analysis, that can therefore empower epidemiological analyses to continuously enable surveillance and treatment evaluation in any setting.
After installing this package, R knows ~70,000 distinct microbial species and all ~550 antibiotic, antimycotic and antiviral drugs by name and code (including ATC, EARS-NET, LOINC and SNOMED CT), and knows all about valid R/SI and MIC values. It supports any data format, including WHONET/EARS-Net data.
This package is fully independent of any other R package and works on Windows, macOS and Linux with all versions of R since R-3.0.0 (April 2013). It was designed to work in any setting, including those with very limited resources. It was created for both routine data analysis and academic research at the Faculty of Medical Sciences of the University of Groningen, in collaboration with non-profit organisations Certe Medical Diagnostics and Advice and University Medical Center Groningen. This R package is actively maintained and free software; you can freely use and distribute it for both personal and commercial (but not patent) purposes under the terms of the GNU General Public License version 2.0 (GPL-2), as published by the Free Software Foundation.
This is the development source of the `AMR` package for R. Not a developer? Then please visit our website [https://msberends.github.io/AMR](https://msberends.github.io/AMR) to read more about this package.
*NOTE: this source code is on GitHub (https://github.com/msberends/AMR), but also automatically mirrored to GitLab (https://gitlab.com/msberends/AMR).*

14
_pkgdown.yml

@ -70,20 +70,20 @@ navbar: @@ -70,20 +70,20 @@ navbar:
href: "articles/benchmarks.html"
- text: "Manual"
icon: "fa-book-open"
href: "reference/"
href: "reference/index.html"
- text: "Authors"
icon: "fa-users"
href: "authors.html"
- text: "Changelog"
icon: "far fa-newspaper"
href: "news/"
href: "news/index.html"
right:
- text: "Source Code"
icon: "fab fa-github"
href: "https://github.com/msberends/AMR"
- text: "Licence"
icon: "fa-book"
href: "LICENSE-text.html"
- text: "Survey"
icon: "fa-clipboard-list"
href: "survey.html"
reference:
- title: "Cleaning your data"
@ -156,7 +156,7 @@ reference: @@ -156,7 +156,7 @@ reference:
- "`catalogue_of_life_version`"
- "`WHOCC`"
- "`lifecycle`"
- title: Other functions
- title: "Other functions"
desc: >
These functions are mostly for internal use, but some of
them may also be suitable for your analysis. Especially the
@ -164,7 +164,7 @@ reference: @@ -164,7 +164,7 @@ reference:
contents:
- "`get_locale`"
- "`like`"
- title: Deprecated functions
- title: "Deprecated functions"
desc: >
These functions are deprecated, meaning that they will still
work but show a warning with every use and will be removed

6
data-raw/create_survey_page.R

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
license_text <- readLines("docs/LICENSE-text.html")
license_text <- paste(license_text, collapse = "|||")
license_text <- gsub("licen(s|c)e", "Survey", license_text, ignore.case = TRUE)
license_text <- gsub("<pre>.*</pre>", '<p>If no form is showing below, please <a href="https://forms.office.com/Pages/ResponsePage.aspx?id=-SJRM_TUZ02i_M1twg3ecDlnO1BBtdxGi-GnYu7DKfdUNTFLQ0xVSUlRVVlXTlVTNjZFMjdRUVpCSy4u" target="_blank">click here to open it</a>.</p><iframe width="100%" height= "500px" src= "https://forms.office.com/Pages/ResponsePage.aspx?id=-SJRM_TUZ02i_M1twg3ecDlnO1BBtdxGi-GnYu7DKfdUNTFLQ0xVSUlRVVlXTlVTNjZFMjdRUVpCSy4u&embed=true" frameborder= "0" marginwidth= "0" marginheight= "0" style= "border: none; max-width:100%; max-height:100vh" allowfullscreen webkitallowfullscreen mozallowfullscreen msallowfullscreen> </iframe>', license_text)
writeLines(unlist(strsplit(license_text, "|||", fixed = TRUE)), "docs/survey.html")

2
data-raw/eucast_rules.tsv

@ -177,7 +177,7 @@ genus_species is Clostridium innocuum VAN R Table 04: Intrinsic resistance in @@ -177,7 +177,7 @@ genus_species is Clostridium innocuum VAN R Table 04: Intrinsic resistance in
genus_species like ^Streptococcus (pyogenes|agalactiae|dysgalactiae|group A|group B|group C|group G) PEN S aminopenicillins, cephalosporins_except_CAZ, carbapenems S Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci Expert Rules
genus is Enterococcus AMP R ureidopenicillins, carbapenems R Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci Expert Rules
genus is Enterococcus AMX R ureidopenicillins, carbapenems R Table 08: Interpretive rules for B-lactam agents and Gram-positive cocci Expert Rules
family is Enterobacteriaceae TIC, PIP R, S PIP R Table 09: Interpretive rules for B-lactam agents and Gram-negative rods Expert Rules
order is Enterobacterales TIC, PIP R, S PIP R Table 09: Interpretive rules for B-lactam agents and Gram-negative rods (at the time: Enterobacteriaceae) Expert Rules
genus like .* ERY S AZM, CLR S Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins Expert Rules
genus like .* ERY I AZM, CLR I Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins Expert Rules
genus like .* ERY R AZM, CLR R Table 11: Interpretive rules for macrolides, lincosamides, and streptogramins Expert Rules

Can't render this file because it contains an unexpected character in line 6 and column 96.

12
docs/404.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR/index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9037</span>
</span>
</div>
@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
</ul>
</li>
<li>
<a href="reference/">
<a href="reference/index.html">
<span class="fa fa-book-open"></span>
Manual
@ -190,7 +190,7 @@ @@ -190,7 +190,7 @@
</a>
</li>
<li>
<a href="news/">
<a href="news/index.html">
<span class="far fa far fa-newspaper"></span>
Changelog
@ -206,10 +206,10 @@ @@ -206,10 +206,10 @@
</a>
</li>
<li>
<a href="LICENSE-text.html">
<span class="fa fa-book"></span>
<a href="survey.html">
<span class="fa fa-clipboard-list"></span>
Licence
Survey
</a>
</li>
</ul>

12
docs/LICENSE-text.html

@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9036</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9037</span>
</span>
</div>
@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
</ul>
</li>
<li>
<a href="reference/">
<a href="reference/index.html">
<span class="fa fa-book-open"></span>
Manual
@ -190,7 +190,7 @@ @@ -190,7 +190,7 @@
</a>
</li>
<li>
<a href="news/">
<a href="news/index.html">
<span class="far fa far fa-newspaper"></span>
Changelog
@ -206,10 +206,10 @@ @@ -206,10 +206,10 @@
</a>
</li>
<li>
<a href="LICENSE-text.html">
<span class="fa fa-book"></span>
<a href="survey.html">
<span class="fa fa-clipboard-list"></span>
Licence
Survey
</a>
</li>
</ul>

476
docs/articles/AMR.html

@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9030</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.2.0.9037</span>
</span>
</div>
@ -134,7 +134,7 @@ @@ -134,7 +134,7 @@
</ul>
</li>
<li>
<a href="../reference/">
<a href="../reference/index.html">
<span class="fa fa-book-open"></span>
Manual
@ -148,7 +148,7 @@ @@ -148,7 +148,7 @@
</a>
</li>
<li>
<a href="../news/">
<a href="../news/index.html">
<span class="far fa far fa-newspaper"></span>
Changelog
@ -164,10 +164,10 @@ @@ -164,10 +164,10 @@
</a>
</li>
<li>
<a href="../LICENSE-text.html">
<span class="fa fa-book"></span>
<a href="../survey.html">
<span class="fa fa-clipboard-list"></span>
Licence
Survey
</a>
</li>
</ul>
@ -186,7 +186,7 @@ @@ -186,7 +186,7 @@
<h1 data-toc-skip>How to conduct AMR analysis</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">09 July 2020</h4>
<h4 class="date">24 July 2020</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div>
@ -195,7 +195,7 @@ @@ -195,7 +195,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 09 July 2020.</p>
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 24 July 2020.</p>
<div id="introduction" class="section level1">
<h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1>
@ -226,21 +226,21 @@ @@ -226,21 +226,21 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2020-07-09</td>
<td align="center">2020-07-24</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
</tr>
<tr class="even">
<td align="center">2020-07-09</td>
<td align="center">2020-07-24</td>
<td align="center">abcd</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
</tr>
<tr class="odd">
<td align="center">2020-07-09</td>
<td align="center">2020-07-24</td>
<td align="center">efgh</td>
<td align="center">Escherichia coli</td>
<td align="center">R</td>
@ -336,66 +336,66 @@ @@ -336,66 +336,66 @@
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-01-30</td>
<td align="center">Y5</td>
<td align="center">Hospital A</td>
<td align="center">2014-06-04</td>
<td align="center">V5</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-11-13</td>
<td align="center">Y1</td>
<td align="center">Hospital D</td>
<td align="center">2015-09-20</td>
<td align="center">M6</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">F</td>
<td align="center">M</td>
</tr>
<tr class="odd">
<td align="center">2016-07-21</td>
<td align="center">U10</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">I</td>
<td align="center">2017-05-14</td>
<td align="center">Q6</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2013-03-14</td>
<td align="center">Q1</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">2017-03-12</td>
<td align="center">O3</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella 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">F</td>
</tr>
<tr class="odd">
<td align="center">2013-04-22</td>
<td align="center">O8</td>
<td align="center">2017-12-27</td>
<td align="center">P8</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</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">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2017-11-14</td>
<td align="center">J4</td>
<td align="center">Hospital A</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">S</td>
<td align="center">2013-11-30</td>
<td align="center">B10</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -432,18 +432,18 @@ Longest: 1</p> @@ -432,18 +432,18 @@ Longest: 1</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">M</td>
<td align="right">10,300</td>
<td align="right">51.5%</td>
<td align="right">10,300</td>
<td align="right">51.5%</td>
<td align="right">10,487</td>
<td align="right">52.44%</td>
<td align="right">10,487</td>
<td align="right">52.44%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">F</td>
<td align="right">9,700</td>
<td align="right">48.5%</td>
<td align="right">9,513</td>
<td align="right">47.57%</td>
<td align="right">20,000</td>
<td align="right">100.0%</td>
<td align="right">100.00%</td>
</tr>
</tbody>
</table>
@ -481,7 +481,7 @@ Longest: 1</p> @@ -481,7 +481,7 @@ Longest: 1</p>
<span class="co"># NOTE: Using column `bacteria` as input for `col_mo`.</span>
<span class="co"># NOTE: Using column `date` as input for `col_date`.</span>
<span class="co"># NOTE: Using column `patient_id` as input for `col_patient_id`.</span></pre></body></html></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>
<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>
<div class="sourceCode" id="cb16"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span>(<span class="no">first</span> <span class="kw">==</span> <span class="fl">TRUE</span>)</pre></body></html></div>
<p>For future use, the above two syntaxes can be shortened with the <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> function:</p>
@ -491,7 +491,7 @@ Longest: 1</p> @@ -491,7 +491,7 @@ Longest: 1</p>
<div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor">
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all isolates of patient Y2, 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 J1, sorted on date:</p>
<table class="table">
<thead><tr class="header">
<th align="center">isolate</th>
@ -507,19 +507,19 @@ Longest: 1</p> @@ -507,19 +507,19 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-03-16</td>
<td align="center">Y2</td>
<td align="center">2010-04-08</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-08-04</td>
<td align="center">Y2</td>
<td align="center">2010-06-01</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -529,21 +529,21 @@ Longest: 1</p> @@ -529,21 +529,21 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-10-06</td>
<td align="center">Y2</td>
<td align="center">2010-06-21</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-11-11</td>
<td align="center">Y2</td>
<td align="center">2010-07-08</td>
<td align="center">J1</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>
@ -551,30 +551,30 @@ Longest: 1</p> @@ -551,30 +551,30 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-11-23</td>
<td align="center">Y2</td>
<td align="center">2011-01-29</td>
<td align="center">J1</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">S</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-04-01</td>
<td align="center">Y2</td>
<td align="center">2011-02-23</td>
<td align="center">J1</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">R</td>
<td align="center">TRUE</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">7</td>
<td align="center">2011-04-27</td>
<td align="center">Y2</td>
<td align="center">2011-02-23</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -584,19 +584,19 @@ Longest: 1</p> @@ -584,19 +584,19 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">8</td>
<td align="center">2011-05-27</td>
<td align="center">Y2</td>
<td align="center">2011-02-28</td>
<td align="center">J1</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">R</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-07-05</td>
<td align="center">Y2</td>
<td align="center">2011-03-13</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -606,14 +606,14 @@ Longest: 1</p> @@ -606,14 +606,14 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-09-25</td>
<td align="center">Y2</td>
<td align="center">2011-05-14</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">S</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
@ -644,20 +644,20 @@ Longest: 1</p> @@ -644,20 +644,20 @@ Longest: 1</p>
<tbody>
<tr class="odd">
<td align="center">1</td>
<td align="center">2010-03-16</td>
<td align="center">Y2</td>
<td align="center">2010-04-08</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2</td>
<td align="center">2010-08-04</td>
<td align="center">Y2</td>
<td align="center">2010-06-01</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -668,80 +668,80 @@ Longest: 1</p> @@ -668,80 +668,80 @@ Longest: 1</p>
</tr>
<tr class="odd">
<td align="center">3</td>
<td align="center">2010-10-06</td>
<td align="center">Y2</td>
<td align="center">2010-06-21</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="even">
<td align="center">4</td>
<td align="center">2010-11-11</td>
<td align="center">Y2</td>
<td align="center">2010-07-08</td>
<td align="center">J1</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">FALSE</td>
<td align="center">TRUE</td>
<td align="center">FALSE</td>
</tr>
<tr class="odd">
<td align="center">5</td>
<td align="center">2010-11-23</td>
<td align="center">Y2</td>
<td align="center">2011-01-29</td>
<td align="center">J1</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">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">6</td>
<td align="center">2011-04-01</td>
<td align="center">Y2</td>
<td align="center">2011-02-23</td>
<td align="center">J1</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">R</td>
<td align="center">TRUE</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">7</td>
<td align="center">2011-04-27</td>
<td align="center">Y2</td>
<td align="center">2011-02-23</td>
<td align="center">J1</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">8</td>
<td align="center">2011-05-27</td>
<td align="center">Y2</td>
<td align="center">2011-02-28</td>
<td align="center">J1</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">R</td>
<td align="center">FALSE</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">9</td>
<td align="center">2011-07-05</td>
<td align="center">Y2</td>
<td align="center">2011-03-13</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
@ -752,23 +752,23 @@ Longest: 1</p> @@ -752,23 +752,23 @@ Longest: 1</p>
</tr>
<tr class="even">
<td align="center">10</td>
<td align="center">2011-09-25</td>
<td align="center">Y2</td>
<td align="center">2011-05-14</td>
<td align="center">J1</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td>
<td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td>
</tr>
</tbody>
</table>
<p>Instead of 2, now 10 isolates are flagged. In total, 78.3% of all isolates are marked ‘first weighted’ - 49.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 7 isolates are flagged. In total, 78.6% of all isolates are marked ‘first weighted’ - 50.2% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, there’s a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb19"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span>()</pre></body></html></div>
<p>So we end up with 15,664 isolates for analysis.</p>
<p>So we end up with 15,719 isolates for analysis.</p>
<p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><html><body><pre class="r"><span class="no">data_1st</span> <span class="kw">&lt;-</span> <span class="no">data_1st</span> <span class="kw">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(-<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">first</span>, <span class="no">keyab</span>))</pre></body></html></div>
@ -776,6 +776,7 @@ Longest: 1</p> @@ -776,6 +776,7 @@ Longest: 1</p>
<div class="sourceCode" id="cb21"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span>(<span class="no">data_1st</span>)</pre></body></html></div>
<table class="table">
<colgroup>
<col width="2%">
<col width="8%">
<col width="8%">
<col width="8%">
@ -791,6 +792,7 @@ Longest: 1</p> @@ -791,6 +792,7 @@ Longest: 1</p>
<col width="11%">
</colgroup>
<thead><tr class="header">
<th align="left"></th>
<th align="center">date</th>
<th align="center">patient_id</th>
<th align="center">hospital</th>
@ -807,11 +809,12 @@ Longest: 1</p> @@ -807,11 +809,12 @@ Longest: 1</p>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center">2016-01-30</td>
<td align="center">Y5</td>
<td align="center">Hospital A</td>
<td align="left">1</td>
<td align="center">2014-06-04</td>
<td align="center">V5</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
@ -822,78 +825,83 @@ Longest: 1</p> @@ -822,78 +825,83 @@ Longest: 1</p>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2010-11-13</td>
<td align="center">Y1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="left">3</td>
<td align="center">2017-05-14</td>
<td align="center">Q6</td>
<td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">Gram-positive</td>
<td align="center">Streptococcus</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2016-07-21</td>
<td align="center">U10</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">4</td>
<td align="center">2017-03-12</td>
<td align="center">O3</td>
<td align="center">Hospital D</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">R</td>
<td 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">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2013-03-14</td>
<td align="center">Q1</td>
<td align="left">5</td>
<td align="center">2017-12-27</td>
<td align="center">P8</td>
<td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>