(v1.7.1.9013) temp fix for ggplot2 bug #4511
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.7.1.9012
|
Version: 1.7.1.9013
|
||||||
Date: 2021-07-04
|
Date: 2021-07-04
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
|
4
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# `AMR` 1.7.1.9012
|
# `AMR` 1.7.1.9013
|
||||||
## <small>Last updated: 4 July 2021</small>
|
## <small>Last updated: 4 July 2021</small>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@ -16,6 +16,8 @@
|
|||||||
* `as.rsi()` can now correct for textual input (such as "Susceptible", "Resistant") in Dutch, English, French, German, Italian, Portuguese and Spanish
|
* `as.rsi()` can now correct for textual input (such as "Susceptible", "Resistant") in Dutch, English, French, German, Italian, Portuguese and Spanish
|
||||||
* When warnings are throws because of too few isolates in any `count_*()`, `proportion_*()` function (or `resistant()` or `susceptible()`), the `dplyr` group will be shown, if available
|
* When warnings are throws because of too few isolates in any `count_*()`, `proportion_*()` function (or `resistant()` or `susceptible()`), the `dplyr` group will be shown, if available
|
||||||
* Taxonomic names now print in italic in tibbles, if created with `mo_name()`, `mo_fullname()`, `mo_shortname()`, `mo_genus()` or `mo_family()`
|
* Taxonomic names now print in italic in tibbles, if created with `mo_name()`, `mo_fullname()`, `mo_shortname()`, `mo_genus()` or `mo_family()`
|
||||||
|
* `ab_name()` gained argument `snake_case`, which is useful for column renaming
|
||||||
|
* Fix for legends created with `scale_rsi_colours()` when using `ggplot2` v3.3.4 or higher (this is `ggplot2` bug #4511, soon to be fixed)
|
||||||
|
|
||||||
|
|
||||||
# `AMR` 1.7.1
|
# `AMR` 1.7.1
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
#' @param ab_class an antimicrobial class, such as `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
|
||||||
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
#' @param only_rsi_columns a [logical] to indicate whether only columns of class `<rsi>` must be selected (defaults to `FALSE`), see [as.rsi()]
|
||||||
#' @details
|
#' @details
|
||||||
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers](https://tidyselect.r-lib.org/reference/language.html), but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
|
#' These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the [Tidyverse selection helpers][tidyselect::language] such as [`everything()`][tidyselect::everything()], but also work in base \R and not only in `dplyr` verbs. Nonetheless, they are very convenient to use with `dplyr` functions such as [`select()`][dplyr::select()], [`filter()`][dplyr::filter()] and [`summarise()`][dplyr::summarise()], see *Examples*.
|
||||||
#'
|
#'
|
||||||
#' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector such as [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the [ab_class()] function to filter/select on a manually defined antibiotic class.
|
#' All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the [antibiotics] data set. This means that a selector such as [aminoglycosides()] will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the [ab_class()] function to filter/select on a manually defined antibiotic class.
|
||||||
#'
|
#'
|
||||||
@ -124,149 +124,168 @@
|
|||||||
#' }
|
#' }
|
||||||
ab_class <- function(ab_class,
|
ab_class <- function(ab_class,
|
||||||
only_rsi_columns = FALSE) {
|
only_rsi_columns = FALSE) {
|
||||||
meet_criteria(ab_class, allow_class = "character", has_length = 1)
|
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE)
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector(NULL, only_rsi_columns = only_rsi_columns, ab_class = ab_class)
|
ab_selector(NULL, only_rsi_columns = only_rsi_columns, ab_class = ab_class)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
aminoglycosides <- function(only_rsi_columns = FALSE) {
|
aminoglycosides <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("aminoglycosides", only_rsi_columns = only_rsi_columns)
|
ab_selector("aminoglycosides", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
aminopenicillins <- function(only_rsi_columns = FALSE) {
|
aminopenicillins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("aminopenicillins", only_rsi_columns = only_rsi_columns)
|
ab_selector("aminopenicillins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
betalactams <- function(only_rsi_columns = FALSE) {
|
betalactams <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("betalactams", only_rsi_columns = only_rsi_columns)
|
ab_selector("betalactams", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
carbapenems <- function(only_rsi_columns = FALSE) {
|
carbapenems <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("carbapenems", only_rsi_columns = only_rsi_columns)
|
ab_selector("carbapenems", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins <- function(only_rsi_columns = FALSE) {
|
cephalosporins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins_1st <- function(only_rsi_columns = FALSE) {
|
cephalosporins_1st <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins_1st", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins_1st", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins_2nd <- function(only_rsi_columns = FALSE) {
|
cephalosporins_2nd <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins_2nd", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins_2nd", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins_3rd <- function(only_rsi_columns = FALSE) {
|
cephalosporins_3rd <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins_3rd", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins_3rd", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins_4th <- function(only_rsi_columns = FALSE) {
|
cephalosporins_4th <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins_4th", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins_4th", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
cephalosporins_5th <- function(only_rsi_columns = FALSE) {
|
cephalosporins_5th <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("cephalosporins_5th", only_rsi_columns = only_rsi_columns)
|
ab_selector("cephalosporins_5th", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
fluoroquinolones <- function(only_rsi_columns = FALSE) {
|
fluoroquinolones <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("fluoroquinolones", only_rsi_columns = only_rsi_columns)
|
ab_selector("fluoroquinolones", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
glycopeptides <- function(only_rsi_columns = FALSE) {
|
glycopeptides <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("glycopeptides", only_rsi_columns = only_rsi_columns)
|
ab_selector("glycopeptides", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
lincosamides <- function(only_rsi_columns = FALSE) {
|
lincosamides <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("lincosamides", only_rsi_columns = only_rsi_columns)
|
ab_selector("lincosamides", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
lipoglycopeptides <- function(only_rsi_columns = FALSE) {
|
lipoglycopeptides <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("lipoglycopeptides", only_rsi_columns = only_rsi_columns)
|
ab_selector("lipoglycopeptides", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
macrolides <- function(only_rsi_columns = FALSE) {
|
macrolides <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("macrolides", only_rsi_columns = only_rsi_columns)
|
ab_selector("macrolides", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
oxazolidinones <- function(only_rsi_columns = FALSE) {
|
oxazolidinones <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("oxazolidinones", only_rsi_columns = only_rsi_columns)
|
ab_selector("oxazolidinones", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
penicillins <- function(only_rsi_columns = FALSE) {
|
penicillins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("penicillins", only_rsi_columns = only_rsi_columns)
|
ab_selector("penicillins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
polymyxins <- function(only_rsi_columns = FALSE) {
|
polymyxins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("polymyxins", only_rsi_columns = only_rsi_columns)
|
ab_selector("polymyxins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
streptogramins <- function(only_rsi_columns = FALSE) {
|
streptogramins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("streptogramins", only_rsi_columns = only_rsi_columns)
|
ab_selector("streptogramins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
quinolones <- function(only_rsi_columns = FALSE) {
|
quinolones <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("quinolones", only_rsi_columns = only_rsi_columns)
|
ab_selector("quinolones", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
tetracyclines <- function(only_rsi_columns = FALSE) {
|
tetracyclines <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("tetracyclines", only_rsi_columns = only_rsi_columns)
|
ab_selector("tetracyclines", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname antibiotic_class_selectors
|
#' @rdname antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
ureidopenicillins <- function(only_rsi_columns = FALSE) {
|
ureidopenicillins <- function(only_rsi_columns = FALSE) {
|
||||||
|
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
|
||||||
ab_selector("ureidopenicillins", only_rsi_columns = only_rsi_columns)
|
ab_selector("ureidopenicillins", only_rsi_columns = only_rsi_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
ab_selector <- function(function_name,
|
ab_selector <- function(function_name,
|
||||||
only_rsi_columns,
|
only_rsi_columns,
|
||||||
ab_class = NULL) {
|
ab_class = NULL) {
|
||||||
meet_criteria(function_name, allow_class = "character", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
|
|
||||||
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = 1)
|
|
||||||
meet_criteria(ab_class, allow_class = "character", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
|
|
||||||
|
|
||||||
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
|
# get_current_data() has to run each time, for cases where e.g., filter() and select() are used in same call
|
||||||
# but it only takes a couple of milliseconds
|
# but it only takes a couple of milliseconds
|
||||||
vars_df <- get_current_data(arg_name = NA, call = -3)
|
vars_df <- get_current_data(arg_name = NA, call = -3)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#' @inheritSection lifecycle Stable Lifecycle
|
#' @inheritSection lifecycle Stable Lifecycle
|
||||||
#' @param x any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
#' @param x any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
|
||||||
#' @param tolower a [logical] to indicate whether the first [character] of every output should be transformed to a lower case [character]. This will lead to e.g. "polymyxin B" and not "polymyxin b".
|
#' @param tolower a [logical] to indicate whether the first [character] of every output should be transformed to a lower case [character]. This will lead to e.g. "polymyxin B" and not "polymyxin b".
|
||||||
|
#' @param snake_case a [logical] to indicate whether the names should be returned in so-called [snake case](https://en.wikipedia.org/wiki/Snake_case): in lower case and all spaces/slashes replaced with an underscore (`_`). This is useful for column renaming.
|
||||||
#' @param property one of the column names of one of the [antibiotics] data set
|
#' @param property one of the column names of one of the [antibiotics] data set
|
||||||
#' @param language language of the returned text, defaults to system language (see [get_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation.
|
#' @param language language of the returned text, defaults to system language (see [get_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation.
|
||||||
#' @param administration way of administration, either `"oral"` or `"iv"`
|
#' @param administration way of administration, either `"oral"` or `"iv"`
|
||||||
@ -88,10 +89,11 @@
|
|||||||
#' ab_atc("cephtriaxone")
|
#' ab_atc("cephtriaxone")
|
||||||
#' ab_atc("cephthriaxone")
|
#' ab_atc("cephthriaxone")
|
||||||
#' ab_atc("seephthriaaksone")
|
#' ab_atc("seephthriaaksone")
|
||||||
ab_name <- function(x, language = get_locale(), tolower = FALSE, ...) {
|
ab_name <- function(x, language = get_locale(), tolower = FALSE, snake_case = FALSE, ...) {
|
||||||
meet_criteria(x, allow_NA = TRUE)
|
meet_criteria(x, allow_NA = TRUE)
|
||||||
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
meet_criteria(language, has_length = 1, is_in = c(LANGUAGES_SUPPORTED, ""), allow_NULL = TRUE, allow_NA = TRUE)
|
||||||
meet_criteria(tolower, allow_class = "logical", has_length = 1)
|
meet_criteria(tolower, allow_class = "logical", has_length = 1)
|
||||||
|
meet_criteria(snake_case, allow_class = "logical", has_length = 1)
|
||||||
|
|
||||||
x <- translate_AMR(ab_validate(x = x, property = "name", ...), language = language, only_affect_ab_names = TRUE)
|
x <- translate_AMR(ab_validate(x = x, property = "name", ...), language = language, only_affect_ab_names = TRUE)
|
||||||
if (tolower == TRUE) {
|
if (tolower == TRUE) {
|
||||||
@ -99,6 +101,9 @@ ab_name <- function(x, language = get_locale(), tolower = FALSE, ...) {
|
|||||||
# as we want "polymyxin B", not "polymyxin b"
|
# as we want "polymyxin B", not "polymyxin b"
|
||||||
x <- gsub("^([A-Z])", "\\L\\1", x, perl = TRUE)
|
x <- gsub("^([A-Z])", "\\L\\1", x, perl = TRUE)
|
||||||
}
|
}
|
||||||
|
if (snake_case == TRUE) {
|
||||||
|
x <- tolower(gsub("[^a-zA-Z0-9]+", "_", x))
|
||||||
|
}
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,6 @@ scale_rsi_colours <- function(...,
|
|||||||
aesthetics = "fill") {
|
aesthetics = "fill") {
|
||||||
stop_ifnot_installed("ggplot2")
|
stop_ifnot_installed("ggplot2")
|
||||||
meet_criteria(aesthetics, allow_class = "character", is_in = c("alpha", "colour", "color", "fill", "linetype", "shape", "size"))
|
meet_criteria(aesthetics, allow_class = "character", is_in = c("alpha", "colour", "color", "fill", "linetype", "shape", "size"))
|
||||||
|
|
||||||
# behaviour until AMR pkg v1.5.0 and also when coming from ggplot_rsi()
|
# behaviour until AMR pkg v1.5.0 and also when coming from ggplot_rsi()
|
||||||
if ("colours" %in% names(list(...))) {
|
if ("colours" %in% names(list(...))) {
|
||||||
original_cols <- c(S = "#3CAEA3",
|
original_cols <- c(S = "#3CAEA3",
|
||||||
@ -379,7 +378,9 @@ scale_rsi_colours <- function(...,
|
|||||||
IR = "#ED553B",
|
IR = "#ED553B",
|
||||||
R = "#ED553B")
|
R = "#ED553B")
|
||||||
colours <- replace(original_cols, names(list(...)$colours), list(...)$colours)
|
colours <- replace(original_cols, names(list(...)$colours), list(...)$colours)
|
||||||
return(ggplot2::scale_fill_manual(values = colours))
|
# limits = force is needed in ggplot2 3.3.4 and 3.3.5, see here;
|
||||||
|
# https://github.com/tidyverse/ggplot2/issues/4511#issuecomment-866185530
|
||||||
|
return(ggplot2::scale_fill_manual(values = colours, limits = force))
|
||||||
}
|
}
|
||||||
if (identical(unlist(list(...)), FALSE)) {
|
if (identical(unlist(list(...)), FALSE)) {
|
||||||
return(invisible())
|
return(invisible())
|
||||||
@ -411,7 +412,9 @@ scale_rsi_colours <- function(...,
|
|||||||
dots[dots == "I"] <- "#F6D55C"
|
dots[dots == "I"] <- "#F6D55C"
|
||||||
dots[dots == "R"] <- "#ED553B"
|
dots[dots == "R"] <- "#ED553B"
|
||||||
cols <- replace(original_cols, names(dots), dots)
|
cols <- replace(original_cols, names(dots), dots)
|
||||||
ggplot2::scale_discrete_manual(aesthetics = aesthetics, values = cols)
|
# limits = force is needed in ggplot2 3.3.4 and 3.3.5, see here;
|
||||||
|
# https://github.com/tidyverse/ggplot2/issues/4511#issuecomment-866185530
|
||||||
|
ggplot2::scale_discrete_manual(aesthetics = aesthetics, values = cols, limits = force)
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @rdname ggplot_rsi
|
#' @rdname ggplot_rsi
|
||||||
|
12
R/plot.R
@ -276,8 +276,10 @@ ggplot.mic <- function(data,
|
|||||||
names(vals) <- translate_AMR(names(vals), language = language)
|
names(vals) <- translate_AMR(names(vals), language = language)
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(ggplot2::aes(x = mic, y = count, fill = cols)) +
|
ggplot2::geom_col(ggplot2::aes(x = mic, y = count, fill = cols)) +
|
||||||
|
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
|
||||||
ggplot2::scale_fill_manual(values = vals,
|
ggplot2::scale_fill_manual(values = vals,
|
||||||
name = NULL)
|
name = NULL,
|
||||||
|
limits = force)
|
||||||
} else {
|
} else {
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(ggplot2::aes(x = mic, y = count))
|
ggplot2::geom_col(ggplot2::aes(x = mic, y = count))
|
||||||
@ -500,8 +502,10 @@ ggplot.disk <- function(data,
|
|||||||
names(vals) <- translate_AMR(names(vals), language = language)
|
names(vals) <- translate_AMR(names(vals), language = language)
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(ggplot2::aes(x = disk, y = count, fill = cols)) +
|
ggplot2::geom_col(ggplot2::aes(x = disk, y = count, fill = cols)) +
|
||||||
|
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
|
||||||
ggplot2::scale_fill_manual(values = vals,
|
ggplot2::scale_fill_manual(values = vals,
|
||||||
name = NULL)
|
name = NULL,
|
||||||
|
limits = force)
|
||||||
} else {
|
} else {
|
||||||
p <- p +
|
p <- p +
|
||||||
ggplot2::geom_col(ggplot2::aes(x = disk, y = count))
|
ggplot2::geom_col(ggplot2::aes(x = disk, y = count))
|
||||||
@ -660,9 +664,11 @@ ggplot.rsi <- function(data,
|
|||||||
|
|
||||||
p +
|
p +
|
||||||
ggplot2::geom_col(ggplot2::aes(x = rsi, y = count, fill = rsi)) +
|
ggplot2::geom_col(ggplot2::aes(x = rsi, y = count, fill = rsi)) +
|
||||||
|
# limits = force is needed because of a ggplot2 >= 3.3.4 bug (#4511)
|
||||||
ggplot2::scale_fill_manual(values = c("R" = colours_RSI[1],
|
ggplot2::scale_fill_manual(values = c("R" = colours_RSI[1],
|
||||||
"S" = colours_RSI[2],
|
"S" = colours_RSI[2],
|
||||||
"I" = colours_RSI[3])) +
|
"I" = colours_RSI[3]),
|
||||||
|
limits = force) +
|
||||||
ggplot2::labs(title = title, x = xlab, y = ylab) +
|
ggplot2::labs(title = title, x = xlab, y = ylab) +
|
||||||
ggplot2::theme(legend.position = "none")
|
ggplot2::theme(legend.position = "none")
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
12
docs/articles/AMR_files/header-attrs-2.9/header-attrs.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
|
||||||
|
// be compatible with the behavior of Pandoc < 2.8).
|
||||||
|
document.addEventListener('DOMContentLoaded', function(e) {
|
||||||
|
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
|
||||||
|
var i, h, a;
|
||||||
|
for (i = 0; i < hs.length; i++) {
|
||||||
|
h = hs[i];
|
||||||
|
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
|
||||||
|
a = h.attributes;
|
||||||
|
while (a.length > 0) h.removeAttribute(a[0].name);
|
||||||
|
}
|
||||||
|
});
|
@ -39,7 +39,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -236,9 +236,9 @@
|
|||||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="amr-1719012" class="section level1">
|
<div id="amr-1719013" class="section level1">
|
||||||
<h1 class="page-header" data-toc-text="1.7.1.9012">
|
<h1 class="page-header" data-toc-text="1.7.1.9013">
|
||||||
<a href="#amr-1719012" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9012</h1>
|
<a href="#amr-1719013" class="anchor"></a><small> Unreleased </small><code>AMR</code> 1.7.1.9013</h1>
|
||||||
<div id="last-updated-4-july-2021" class="section level2">
|
<div id="last-updated-4-july-2021" class="section level2">
|
||||||
<h2 class="hasAnchor">
|
<h2 class="hasAnchor">
|
||||||
<a href="#last-updated-4-july-2021" class="anchor"></a><small>Last updated: 4 July 2021</small>
|
<a href="#last-updated-4-july-2021" class="anchor"></a><small>Last updated: 4 July 2021</small>
|
||||||
@ -270,6 +270,9 @@
|
|||||||
<li>When warnings are throws because of too few isolates in any <code>count_*()</code>, <code>proportion_*()</code> function (or <code>resistant()</code> or <code>susceptible()</code>), the <code>dplyr</code> group will be shown, if available</li>
|
<li>When warnings are throws because of too few isolates in any <code>count_*()</code>, <code>proportion_*()</code> function (or <code>resistant()</code> or <code>susceptible()</code>), the <code>dplyr</code> group will be shown, if available</li>
|
||||||
<li>Taxonomic names now print in italic in tibbles, if created with <code><a href="../reference/mo_property.html">mo_name()</a></code>, <code><a href="../reference/mo_property.html">mo_fullname()</a></code>, <code><a href="../reference/mo_property.html">mo_shortname()</a></code>, <code><a href="../reference/mo_property.html">mo_genus()</a></code> or <code><a href="../reference/mo_property.html">mo_family()</a></code>
|
<li>Taxonomic names now print in italic in tibbles, if created with <code><a href="../reference/mo_property.html">mo_name()</a></code>, <code><a href="../reference/mo_property.html">mo_fullname()</a></code>, <code><a href="../reference/mo_property.html">mo_shortname()</a></code>, <code><a href="../reference/mo_property.html">mo_genus()</a></code> or <code><a href="../reference/mo_property.html">mo_family()</a></code>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<code><a href="../reference/ab_property.html">ab_name()</a></code> gained argument <code>snake_case</code>, which is useful for column renaming</li>
|
||||||
|
<li>Fix for legends created with <code><a href="../reference/ggplot_rsi.html">scale_rsi_colours()</a></code> when using <code>ggplot2</code> v3.3.4 or higher (this is <code>ggplot2</code> bug <a href='https://github.com/msberends/AMR/issues/4511'>#4511</a>, soon to be fixed)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -323,7 +326,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Function <code><a href="../reference/antibiotic_class_selectors.html">betalactams()</a></code> as additional antbiotic column selector and function <code><a href="../reference/AMR-deprecated.html">filter_betalactams()</a></code> as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</li>
|
<li>Function <code><a href="../reference/antibiotic_class_selectors.html">betalactams()</a></code> as additional antbiotic column selector and function <code><a href="../reference/AMR-deprecated.html">filter_betalactams()</a></code> as additional antbiotic column filter. The group of betalactams consists of all carbapenems, cephalosporins and penicillins.</li>
|
||||||
<li>A <code>ggplot()</code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
|
<li>A <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> method for <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -424,7 +427,7 @@
|
|||||||
<span class="co">#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
|
<span class="co">#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Support for custom MDRO guidelines, using the new <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function, please see <code><a href="../reference/mdro.html">mdro()</a></code> for additional info</p></li>
|
<li><p>Support for custom MDRO guidelines, using the new <code><a href="../reference/mdro.html">custom_mdro_guideline()</a></code> function, please see <code><a href="../reference/mdro.html">mdro()</a></code> for additional info</p></li>
|
||||||
<li><p><code>ggplot()</code> generics for classes <code><mic></code> and <code><disk></code></p></li>
|
<li><p><code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> generics for classes <code><mic></code> and <code><disk></code></p></li>
|
||||||
<li>
|
<li>
|
||||||
<p>Function <code><a href="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
|
<p>Function <code><a href="../reference/mo_property.html">mo_is_yeast()</a></code>, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:</p>
|
||||||
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
|
||||||
@ -481,7 +484,7 @@
|
|||||||
<li>Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent</li>
|
<li>Plotting of MIC and disk diffusion values now support interpretation colouring if you supply the microorganism and antimicrobial agent</li>
|
||||||
<li>All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)</li>
|
<li>All colours were updated to colour-blind friendly versions for values R, S and I for all plot methods (also applies to tibble printing)</li>
|
||||||
<li>Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see <code>translate</code>)</li>
|
<li>Interpretation of MIC and disk diffusion values to R/SI will now be translated if the system language is German, Dutch or Spanish (see <code>translate</code>)</li>
|
||||||
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code>ggplot()</code> on any vector of MIC and disk diffusion values</li>
|
<li>Plotting is now possible with base R using <code><a href="../reference/plot.html">plot()</a></code> and with ggplot2 using <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot()</a></code> on any vector of MIC and disk diffusion values</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the <code>microorganisms</code> data set</li>
|
<li>Updated SNOMED codes to US Edition of SNOMED CT from 1 September 2020 and added the source to the help page of the <code>microorganisms</code> data set</li>
|
||||||
@ -833,7 +836,7 @@
|
|||||||
<p>Making this package independent of especially the tidyverse (e.g. packages <code>dplyr</code> and <code>tidyr</code>) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.</p>
|
<p>Making this package independent of especially the tidyverse (e.g. packages <code>dplyr</code> and <code>tidyr</code>) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.</p>
|
||||||
<p>Negative effects of this change are:</p>
|
<p>Negative effects of this change are:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Function <code>freq()</code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://github.com/msberends/cleaner">library("cleaner")</a></code> before you use <code>freq()</code>.</li>
|
<li>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> that was borrowed from the <code>cleaner</code> package was removed. Use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">cleaner::freq()</a></code>, or run <code><a href="https://github.com/msberends/cleaner">library("cleaner")</a></code> before you use <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>.</li>
|
||||||
<li><del>Printing values of class <code>mo</code> or <code>rsi</code> in a tibble will no longer be in colour and printing <code>rsi</code> in a tibble will show the class <code><ord></code>, not <code><rsi></code> anymore. This is purely a visual effect.</del></li>
|
<li><del>Printing values of class <code>mo</code> or <code>rsi</code> in a tibble will no longer be in colour and printing <code>rsi</code> in a tibble will show the class <code><ord></code>, not <code><rsi></code> anymore. This is purely a visual effect.</del></li>
|
||||||
<li><del>All functions from the <code>mo_*</code> family (like <code><a href="../reference/mo_property.html">mo_name()</a></code> and <code><a href="../reference/mo_property.html">mo_gramstain()</a></code>) are noticeably slower when running on hundreds of thousands of rows.</del></li>
|
<li><del>All functions from the <code>mo_*</code> family (like <code><a href="../reference/mo_property.html">mo_name()</a></code> and <code><a href="../reference/mo_property.html">mo_gramstain()</a></code>) are noticeably slower when running on hundreds of thousands of rows.</del></li>
|
||||||
<li>For developers: classes <code>mo</code> and <code>ab</code> now both also inherit class <code>character</code>, to support any data transformation. This change invalidates code that checks for class length == 1.</li>
|
<li>For developers: classes <code>mo</code> and <code>ab</code> now both also inherit class <code>character</code>, to support any data transformation. This change invalidates code that checks for class length == 1.</li>
|
||||||
@ -1165,7 +1168,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<span class="co">#> invalid microorganism code, NA generated</span></code></pre></div>
|
<span class="co">#> invalid microorganism code, NA generated</span></code></pre></div>
|
||||||
<p>This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</p>
|
<p>This is important, because a value like <code>"testvalue"</code> could never be understood by e.g. <code><a href="../reference/mo_property.html">mo_name()</a></code>, although the class would suggest a valid microbial code.</p>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code>freq()</code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</p></li>
|
<li><p>Function <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>), since creating frequency tables actually does not fit the scope of this package. The <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function still works, since it is re-exported from the <code>clean</code> package (which will be installed automatically upon updating this <code>AMR</code> package).</p></li>
|
||||||
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
|
<li><p>Renamed data set <code>septic_patients</code> to <code>example_isolates</code></p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -1432,7 +1435,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new argument <code>exact</code> to determine ages with decimals</li>
|
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new argument <code>exact</code> to determine ages with decimals</li>
|
||||||
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
|
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Frequency tables (<code>freq()</code>):
|
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>):
|
||||||
<ul>
|
<ul>
|
||||||
<li><p>speed improvement for microbial IDs</p></li>
|
<li><p>speed improvement for microbial IDs</p></li>
|
||||||
<li><p>fixed factor level names for R Markdown</p></li>
|
<li><p>fixed factor level names for R Markdown</p></li>
|
||||||
@ -1442,12 +1445,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
|
||||||
<code class="sourceCode R">
|
<code class="sourceCode R">
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span>
|
||||||
<span class="co"># grouped boxplots:</span>
|
<span class="co"># grouped boxplots:</span>
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
|
<span class="fu"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -1457,7 +1460,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
|
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
|
||||||
</li>
|
</li>
|
||||||
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
|
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
|
||||||
<li>Fix for <code>freq()</code> for when all values are <code>NA</code>
|
<li>Fix for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> for when all values are <code>NA</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
|
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
|
||||||
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
|
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
|
||||||
@ -1696,7 +1699,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Frequency tables (<code>freq()</code> function):
|
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function):
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
|
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
|
||||||
@ -1706,15 +1709,15 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<span class="co"># OLD WAY</span>
|
<span class="co"># OLD WAY</span>
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>genus <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span>genus <span class="op">=</span> <span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">genus</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span><span class="op">)</span>
|
||||||
<span class="co"># NEW WAY</span>
|
<span class="co"># NEW WAY</span>
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span>
|
||||||
|
|
||||||
<span class="co"># Even supports grouping variables:</span>
|
<span class="co"># Even supports grouping variables:</span>
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="fu"><a href="../reference/mo_property.html">mo_genus</a></span><span class="op">(</span><span class="va">mo</span><span class="op">)</span><span class="op">)</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Header info is now available as a list, with the <code>header</code> function</p></li>
|
<li><p>Header info is now available as a list, with the <code>header</code> function</p></li>
|
||||||
<li><p>The argument <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</p></li>
|
<li><p>The argument <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</p></li>
|
||||||
@ -1796,7 +1799,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<li><p>Using <code>portion_*</code> functions now throws a warning when total available isolate is below argument <code>minimum</code></p></li>
|
<li><p>Using <code>portion_*</code> functions now throws a warning when total available isolate is below argument <code>minimum</code></p></li>
|
||||||
<li><p>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</p></li>
|
<li><p>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</p></li>
|
||||||
<li>
|
<li>
|
||||||
<p>Frequency tables - <code>freq()</code>:</p>
|
<p>Frequency tables - <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for grouping variables, test with:</p>
|
<p>Support for grouping variables, test with:</p>
|
||||||
@ -1804,14 +1807,14 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<code class="sourceCode R">
|
<code class="sourceCode R">
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>Support for (un)selecting columns:</p>
|
<p>Support for (un)selecting columns:</p>
|
||||||
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
|
||||||
<code class="sourceCode R">
|
<code class="sourceCode R">
|
||||||
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
<span class="va">septic_patients</span> <span class="op">%>%</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%>%</span>
|
||||||
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="op">-</span><span class="va">count</span>, <span class="op">-</span><span class="va">cum_count</span><span class="op">)</span> <span class="co"># only get item, percent, cum_percent</span></code></pre></div>
|
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="op">-</span><span class="va">count</span>, <span class="op">-</span><span class="va">cum_count</span><span class="op">)</span> <span class="co"># only get item, percent, cum_percent</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code></p></li>
|
<li><p>Check for <code><a href="https://hms.tidyverse.org/reference/Deprecated.html">hms::is.hms</a></code></p></li>
|
||||||
@ -1829,7 +1832,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<li><p>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</p></li>
|
<li><p>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</p></li>
|
||||||
<li><p>Fix for <code>mo_property</code> not working properly</p></li>
|
<li><p>Fix for <code>mo_property</code> not working properly</p></li>
|
||||||
<li><p>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</p></li>
|
<li><p>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</p></li>
|
||||||
<li><p>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code></p></li>
|
<li><p>Support for named vectors of class <code>mo</code>, useful for <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">top_freq()</a></code></p></li>
|
||||||
<li><p><code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> argument</p></li>
|
<li><p><code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> argument</p></li>
|
||||||
<li>
|
<li>
|
||||||
<p>AI improvements for <code>as.mo</code>:</p>
|
<p>AI improvements for <code>as.mo</code>:</p>
|
||||||
@ -1996,13 +1999,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<div class="sourceCode" id="cb49"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb49"><pre class="downlit sourceCode r">
|
||||||
<code class="sourceCode R">
|
<code class="sourceCode R">
|
||||||
<span class="va">my_matrix</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="va">age</span>, <span class="va">gender</span><span class="op">)</span>, ncol <span class="op">=</span> <span class="fl">2</span><span class="op">)</span><span class="op">)</span>
|
<span class="va">my_matrix</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/with.html">with</a></span><span class="op">(</span><span class="va">septic_patients</span>, <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="va">age</span>, <span class="va">gender</span><span class="op">)</span>, ncol <span class="op">=</span> <span class="fl">2</span><span class="op">)</span><span class="op">)</span>
|
||||||
<span class="fu">freq</span><span class="op">(</span><span class="va">my_matrix</span><span class="op">)</span></code></pre></div>
|
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">my_matrix</span><span class="op">)</span></code></pre></div>
|
||||||
<p>For lists, subsetting is possible:</p>
|
<p>For lists, subsetting is possible:</p>
|
||||||
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
|
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
|
||||||
<code class="sourceCode R">
|
<code class="sourceCode R">
|
||||||
<span class="va">my_list</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>age <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">age</span>, gender <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">gender</span><span class="op">)</span>
|
<span class="va">my_list</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>age <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">age</span>, gender <span class="op">=</span> <span class="va">septic_patients</span><span class="op">$</span><span class="va">gender</span><span class="op">)</span>
|
||||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span>
|
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span>
|
||||||
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
<span class="va">my_list</span> <span class="op">%>%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -2075,13 +2078,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
|
|||||||
<ul>
|
<ul>
|
||||||
<li>A vignette to explain its usage</li>
|
<li>A vignette to explain its usage</li>
|
||||||
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
|
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
|
||||||
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
|
<li>Support for <code>table</code> to use as input: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(table(x, y))</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://rdrr.io/r/graphics/hist.html">hist(freq(df$age))</a></code>
|
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://rdrr.io/r/graphics/hist.html">hist(freq(df$age))</a></code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
|
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
<li>Support for quasiquotation: <code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %>% freq(mycolumn)</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
|
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
|
||||||
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
|
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
|
||||||
|
@ -12,7 +12,7 @@ articles:
|
|||||||
datasets: datasets.html
|
datasets: datasets.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
welcome_to_AMR: welcome_to_AMR.html
|
welcome_to_AMR: welcome_to_AMR.html
|
||||||
last_built: 2021-07-04T18:25Z
|
last_built: 2021-07-04T20:09Z
|
||||||
urls:
|
urls:
|
||||||
reference: https://msberends.github.io/AMR//reference
|
reference: https://msberends.github.io/AMR//reference
|
||||||
article: https://msberends.github.io/AMR//articles
|
article: https://msberends.github.io/AMR//articles
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -90,14 +90,14 @@
|
|||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li>
|
<li>
|
||||||
<a href="../index.html">
|
<a href="../index.html">
|
||||||
<span class="fas fa-home"></span>
|
<span class="fa fa-home"></span>
|
||||||
|
|
||||||
Home
|
Home
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||||
<span class="fas fa-question-circle"></span>
|
<span class="fa fa-question-circle"></span>
|
||||||
|
|
||||||
How to
|
How to
|
||||||
|
|
||||||
@ -106,77 +106,77 @@
|
|||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/AMR.html">
|
<a href="../articles/AMR.html">
|
||||||
<span class="fas fa-directions"></span>
|
<span class="fa fa-directions"></span>
|
||||||
|
|
||||||
Conduct AMR analysis
|
Conduct AMR analysis
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/resistance_predict.html">
|
<a href="../articles/resistance_predict.html">
|
||||||
<span class="fas fa-dice"></span>
|
<span class="fa fa-dice"></span>
|
||||||
|
|
||||||
Predict antimicrobial resistance
|
Predict antimicrobial resistance
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/datasets.html">
|
<a href="../articles/datasets.html">
|
||||||
<span class="fas fa-database"></span>
|
<span class="fa fa-database"></span>
|
||||||
|
|
||||||
Data sets for download / own use
|
Data sets for download / own use
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/PCA.html">
|
<a href="../articles/PCA.html">
|
||||||
<span class="fas fa-compress"></span>
|
<span class="fa fa-compress"></span>
|
||||||
|
|
||||||
Conduct principal component analysis for AMR
|
Conduct principal component analysis for AMR
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/MDR.html">
|
<a href="../articles/MDR.html">
|
||||||
<span class="fas fa-skull-crossbones"></span>
|
<span class="fa fa-skull-crossbones"></span>
|
||||||
|
|
||||||
Determine multi-drug resistance (MDR)
|
Determine multi-drug resistance (MDR)
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/WHONET.html">
|
<a href="../articles/WHONET.html">
|
||||||
<span class="fas fa-globe-americas"></span>
|
<span class="fa fa-globe-americas"></span>
|
||||||
|
|
||||||
Work with WHONET data
|
Work with WHONET data
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/SPSS.html">
|
<a href="../articles/SPSS.html">
|
||||||
<span class="fas fa-file-upload"></span>
|
<span class="fa fa-file-upload"></span>
|
||||||
|
|
||||||
Import data from SPSS/SAS/Stata
|
Import data from SPSS/SAS/Stata
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/EUCAST.html">
|
<a href="../articles/EUCAST.html">
|
||||||
<span class="fas fa-exchange-alt"></span>
|
<span class="fa fa-exchange-alt"></span>
|
||||||
|
|
||||||
Apply EUCAST rules
|
Apply EUCAST rules
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../reference/mo_property.html">
|
<a href="../reference/mo_property.html">
|
||||||
<span class="fas fa-bug"></span>
|
<span class="fa fa-bug"></span>
|
||||||
|
|
||||||
Get properties of a microorganism
|
Get properties of a microorganism
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../reference/ab_property.html">
|
<a href="../reference/ab_property.html">
|
||||||
<span class="fas fa-capsules"></span>
|
<span class="fa fa-capsules"></span>
|
||||||
|
|
||||||
Get properties of an antibiotic
|
Get properties of an antibiotic
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../articles/benchmarks.html">
|
<a href="../articles/benchmarks.html">
|
||||||
<span class="fas fa-shipping-fast"></span>
|
<span class="fa fa-shipping-fast"></span>
|
||||||
|
|
||||||
Other: benchmarks
|
Other: benchmarks
|
||||||
</a>
|
</a>
|
||||||
@ -185,14 +185,14 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../reference/index.html">
|
<a href="../reference/index.html">
|
||||||
<span class="fas fa-book-open"></span>
|
<span class="fa fa-book-open"></span>
|
||||||
|
|
||||||
Manual
|
Manual
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../authors.html">
|
<a href="../authors.html">
|
||||||
<span class="fas fa-users"></span>
|
<span class="fa fa-users"></span>
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
</a>
|
</a>
|
||||||
@ -215,7 +215,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="../survey.html">
|
<a href="../survey.html">
|
||||||
<span class="fas fa-clipboard-list"></span>
|
<span class="fa fa-clipboard-list"></span>
|
||||||
|
|
||||||
Survey
|
Survey
|
||||||
</a>
|
</a>
|
||||||
@ -242,7 +242,7 @@
|
|||||||
<p>Use these functions to return a specific property of an antibiotic from the <a href='antibiotics.html'>antibiotics</a> data set. All input values will be evaluated internally with <code><a href='as.ab.html'>as.ab()</a></code>.</p>
|
<p>Use these functions to return a specific property of an antibiotic from the <a href='antibiotics.html'>antibiotics</a> data set. All input values will be evaluated internally with <code><a href='as.ab.html'>as.ab()</a></code>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pre class="usage"><span class='fu'>ab_name</span><span class='op'>(</span><span class='va'>x</span>, language <span class='op'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span><span class='op'>(</span><span class='op'>)</span>, tolower <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span>
|
<pre class="usage"><span class='fu'>ab_name</span><span class='op'>(</span><span class='va'>x</span>, language <span class='op'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span><span class='op'>(</span><span class='op'>)</span>, tolower <span class='op'>=</span> <span class='cn'>FALSE</span>, snake_case <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span>
|
||||||
|
|
||||||
<span class='fu'>ab_atc</span><span class='op'>(</span><span class='va'>x</span>, <span class='va'>...</span><span class='op'>)</span>
|
<span class='fu'>ab_atc</span><span class='op'>(</span><span class='va'>x</span>, <span class='va'>...</span><span class='op'>)</span>
|
||||||
|
|
||||||
@ -283,6 +283,10 @@
|
|||||||
<th>tolower</th>
|
<th>tolower</th>
|
||||||
<td><p>a <a href='https://rdrr.io/r/base/logical.html'>logical</a> to indicate whether the first <a href='https://rdrr.io/r/base/character.html'>character</a> of every output should be transformed to a lower case <a href='https://rdrr.io/r/base/character.html'>character</a>. This will lead to e.g. "polymyxin B" and not "polymyxin b".</p></td>
|
<td><p>a <a href='https://rdrr.io/r/base/logical.html'>logical</a> to indicate whether the first <a href='https://rdrr.io/r/base/character.html'>character</a> of every output should be transformed to a lower case <a href='https://rdrr.io/r/base/character.html'>character</a>. This will lead to e.g. "polymyxin B" and not "polymyxin b".</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>snake_case</th>
|
||||||
|
<td><p>a <a href='https://rdrr.io/r/base/logical.html'>logical</a> to indicate whether the names should be returned in so-called <a href='https://en.wikipedia.org/wiki/Snake_case'>snake case</a>: in lower case and all spaces/slashes replaced with an underscore (<code>_</code>). This is useful for column renaming.</p></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>...</th>
|
<th>...</th>
|
||||||
<td><p>other arguments passed on to <code><a href='as.ab.html'>as.ab()</a></code></p></td>
|
<td><p>other arguments passed on to <code><a href='as.ab.html'>as.ab()</a></code></p></td>
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9009</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -303,7 +303,7 @@
|
|||||||
|
|
||||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||||
|
|
||||||
<p>These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the <a href='https://tidyselect.r-lib.org/reference/language.html'>Tidyverse selection helpers</a>, but also work in base <span style="R">R</span> and not only in <code>dplyr</code> verbs. Nonetheless, they are very convenient to use with <code>dplyr</code> functions such as <code><a href='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>, see <em>Examples</em>.</p>
|
<p>These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the <a href='https://tidyselect.r-lib.org/reference/language.html'>Tidyverse selection helpers</a> such as <code><a href='https://tidyselect.r-lib.org/reference/everything.html'>everything()</a></code>, but also work in base <span style="R">R</span> and not only in <code>dplyr</code> verbs. Nonetheless, they are very convenient to use with <code>dplyr</code> functions such as <code><a href='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code>, <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> and <code><a href='https://dplyr.tidyverse.org/reference/summarise.html'>summarise()</a></code>, see <em>Examples</em>.</p>
|
||||||
<p>All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the <a href='antibiotics.html'>antibiotics</a> data set. This means that a selector such as <code>aminoglycosides()</code> will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the <code>ab_class()</code> function to filter/select on a manually defined antibiotic class.</p>
|
<p>All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the <a href='antibiotics.html'>antibiotics</a> data set. This means that a selector such as <code>aminoglycosides()</code> will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the <code>ab_class()</code> function to filter/select on a manually defined antibiotic class.</p>
|
||||||
<h2 class="hasAnchor" id="full-list-of-supported-agents"><a class="anchor" href="#full-list-of-supported-agents"></a>Full list of supported agents</h2>
|
<h2 class="hasAnchor" id="full-list-of-supported-agents"><a class="anchor" href="#full-list-of-supported-agents"></a>Full list of supported agents</h2>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="navbar-brand">
|
<span class="navbar-brand">
|
||||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9012</span>
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.7.1.9013</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
expect_identical(ab_name("AMX", language = NULL), "Amoxicillin")
|
expect_identical(ab_name("AMX", language = NULL), "Amoxicillin")
|
||||||
|
expect_identical(ab_name("AMX", language = NULL, snake_case = TRUE), "amoxicillin")
|
||||||
expect_identical(as.character(ab_atc("AMX")), "J01CA04")
|
expect_identical(as.character(ab_atc("AMX")), "J01CA04")
|
||||||
expect_identical(ab_cid("AMX"), as.integer(33613))
|
expect_identical(ab_cid("AMX"), as.integer(33613))
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||||
# ==================================================================== #
|
# ==================================================================== #
|
||||||
|
|
||||||
expect_identical(mo_genus("B_GRAMP", language = "pt"),
|
expect_identical(as.character(mo_genus("B_GRAMP", language = "pt")),
|
||||||
"(Gram positivos desconhecidos)")
|
"(Gram positivos desconhecidos)")
|
||||||
|
|
||||||
expect_identical(mo_fullname("CoNS", "en"), "Coagulase-negative Staphylococcus (CoNS)")
|
expect_identical(as.character(mo_fullname("CoNS", "en")), "Coagulase-negative Staphylococcus (CoNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "de"), "Koagulase-negative Staphylococcus (KNS)")
|
expect_identical(as.character(mo_fullname("CoNS", "de")), "Koagulase-negative Staphylococcus (KNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "nl"), "Coagulase-negatieve Staphylococcus (CNS)")
|
expect_identical(as.character(mo_fullname("CoNS", "nl")), "Coagulase-negatieve Staphylococcus (CNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "es"), "Staphylococcus coagulasa negativo (SCN)")
|
expect_identical(as.character(mo_fullname("CoNS", "es")), "Staphylococcus coagulasa negativo (SCN)")
|
||||||
expect_identical(mo_fullname("CoNS", "it"), "Staphylococcus negativo coagulasi (CoNS)")
|
expect_identical(as.character(mo_fullname("CoNS", "it")), "Staphylococcus negativo coagulasi (CoNS)")
|
||||||
expect_identical(mo_fullname("CoNS", "pt"), "Staphylococcus coagulase negativo (CoNS)")
|
expect_identical(as.character(mo_fullname("CoNS", "pt")), "Staphylococcus coagulase negativo (CoNS)")
|
||||||
|
@ -240,8 +240,8 @@ x <- as.mo("S. aur")
|
|||||||
expect_stdout(print(mo_uncertainties()))
|
expect_stdout(print(mo_uncertainties()))
|
||||||
|
|
||||||
# Salmonella (City) are all actually Salmonella enterica spp (City)
|
# Salmonella (City) are all actually Salmonella enterica spp (City)
|
||||||
expect_equal(suppressMessages(mo_name(c("Salmonella Goettingen", "Salmonella Typhimurium", "Salmonella Group A"))),
|
expect_equal(suppressMessages(as.mo(c("Salmonella Goettingen", "Salmonella Typhimurium", "Salmonella Group A"))),
|
||||||
c("Salmonella enterica", "Salmonella enterica", "Salmonella"))
|
as.mo(c("Salmonella enterica", "Salmonella enterica", "Salmonella")))
|
||||||
|
|
||||||
# no virusses
|
# no virusses
|
||||||
expect_equal(as.character(as.mo("Virus")), NA_character_)
|
expect_equal(as.character(as.mo("Virus")), NA_character_)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
\alias{ab_url}
|
\alias{ab_url}
|
||||||
\title{Get Properties of an Antibiotic}
|
\title{Get Properties of an Antibiotic}
|
||||||
\usage{
|
\usage{
|
||||||
ab_name(x, language = get_locale(), tolower = FALSE, ...)
|
ab_name(x, language = get_locale(), tolower = FALSE, snake_case = FALSE, ...)
|
||||||
|
|
||||||
ab_atc(x, ...)
|
ab_atc(x, ...)
|
||||||
|
|
||||||
@ -50,6 +50,8 @@ ab_property(x, property = "name", language = get_locale(), ...)
|
|||||||
|
|
||||||
\item{tolower}{a \link{logical} to indicate whether the first \link{character} of every output should be transformed to a lower case \link{character}. This will lead to e.g. "polymyxin B" and not "polymyxin b".}
|
\item{tolower}{a \link{logical} to indicate whether the first \link{character} of every output should be transformed to a lower case \link{character}. This will lead to e.g. "polymyxin B" and not "polymyxin b".}
|
||||||
|
|
||||||
|
\item{snake_case}{a \link{logical} to indicate whether the names should be returned in so-called \href{https://en.wikipedia.org/wiki/Snake_case}{snake case}: in lower case and all spaces/slashes replaced with an underscore (\verb{_}). This is useful for column renaming.}
|
||||||
|
|
||||||
\item{...}{other arguments passed on to \code{\link[=as.ab]{as.ab()}}}
|
\item{...}{other arguments passed on to \code{\link[=as.ab]{as.ab()}}}
|
||||||
|
|
||||||
\item{administration}{way of administration, either \code{"oral"} or \code{"iv"}}
|
\item{administration}{way of administration, either \code{"oral"} or \code{"iv"}}
|
||||||
|
@ -82,7 +82,7 @@ ureidopenicillins(only_rsi_columns = FALSE)
|
|||||||
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
|
These functions allow for filtering rows and selecting columns based on antibiotic test results that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations.
|
||||||
}
|
}
|
||||||
\details{
|
\details{
|
||||||
These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the \href{https://tidyselect.r-lib.org/reference/language.html}{Tidyverse selection helpers}, but also work in base \R and not only in \code{dplyr} verbs. Nonetheless, they are very convenient to use with \code{dplyr} functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}, see \emph{Examples}.
|
These functions can be used in data set calls for selecting columns and filtering rows. They are heavily inspired by the \link[tidyselect:language]{Tidyverse selection helpers} such as \code{\link[tidyselect:everything]{everything()}}, but also work in base \R and not only in \code{dplyr} verbs. Nonetheless, they are very convenient to use with \code{dplyr} functions such as \code{\link[dplyr:select]{select()}}, \code{\link[dplyr:filter]{filter()}} and \code{\link[dplyr:summarise]{summarise()}}, see \emph{Examples}.
|
||||||
|
|
||||||
All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector such as \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the \code{\link[=ab_class]{ab_class()}} function to filter/select on a manually defined antibiotic class.
|
All columns in the data in which these functions are called will be searched for known antibiotic names, abbreviations, brand names, and codes (ATC, EARS-Net, WHO, etc.) in the \link{antibiotics} data set. This means that a selector such as \code{\link[=aminoglycosides]{aminoglycosides()}} will pick up column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. Use the \code{\link[=ab_class]{ab_class()}} function to filter/select on a manually defined antibiotic class.
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ data_1st %>%
|
|||||||
|
|
||||||
## Overview of different bug/drug combinations
|
## Overview of different bug/drug combinations
|
||||||
|
|
||||||
Using [Tidyverse selections](https://tidyselect.r-lib.org/reference/language.html), you can also select or filter columns based on the antibiotic class they are in:
|
Using [tidyverse selections](https://tidyselect.r-lib.org/reference/language.html), you can also select or filter columns based on the antibiotic class they are in:
|
||||||
|
|
||||||
```{r bug_drg 2a, eval = FALSE}
|
```{r bug_drg 2a, eval = FALSE}
|
||||||
data_1st %>%
|
data_1st %>%
|
||||||
@ -373,7 +373,29 @@ data_1st %>%
|
|||||||
knitr::kable(align = "c", big.mark = ",")
|
knitr::kable(align = "c", big.mark = ",")
|
||||||
```
|
```
|
||||||
|
|
||||||
To make a transition to the next part, let's see how this difference could be plotted:
|
Or if you are curious for the resistance within certain antibiotic classes, use a antibiotic class selector such as `penicillins()`, which automatically will include the columns `AMX` and `AMC` of our data:
|
||||||
|
|
||||||
|
```{r, eval = FALSE}
|
||||||
|
data_1st %>%
|
||||||
|
# group by hospital
|
||||||
|
group_by(hospital) %>%
|
||||||
|
# / -> select all penicillins in the data for calculation
|
||||||
|
# | / -> use resistance() for all peni's per hospital
|
||||||
|
# | | / -> print as percentages
|
||||||
|
summarise(across(penicillins(), resistance, as_percent = TRUE)) %>%
|
||||||
|
# format the antibiotic column names, using so-called snake case,
|
||||||
|
# so 'Amoxicillin/clavulanic acid' becomes 'amoxicillin_clavulanic_acid'
|
||||||
|
rename_with(.fn = ab_name, .cols = penicillins(), snake_case = TRUE)
|
||||||
|
```
|
||||||
|
```{r, echo = FALSE, message = FALSE}
|
||||||
|
data_1st %>%
|
||||||
|
group_by(hospital) %>%
|
||||||
|
summarise(across(penicillins(), resistance, as_percent = TRUE)) %>%
|
||||||
|
rename_with(.fn = ab_name, .cols = penicillins(), snake_case = TRUE) %>%
|
||||||
|
knitr::kable(align = "lrr")
|
||||||
|
```
|
||||||
|
|
||||||
|
To make a transition to the next part, let's see how differences in the previously calculated combination therapies could be plotted:
|
||||||
|
|
||||||
```{r plot 1}
|
```{r plot 1}
|
||||||
data_1st %>%
|
data_1st %>%
|
||||||
@ -456,7 +478,7 @@ data_1st %>%
|
|||||||
|
|
||||||
### Plotting MIC and disk diffusion values
|
### Plotting MIC and disk diffusion values
|
||||||
|
|
||||||
The AMR package also extends the `plot()` and `ggplot()` functions for plotting minimum inhibitory concentrations (MIC, created with `as.mic()`) and disk diffusion diameters (created with `as.disk()`).
|
The AMR package also extends the `plot()` and `ggplot2::autoplot()` functions for plotting minimum inhibitory concentrations (MIC, created with `as.mic()`) and disk diffusion diameters (created with `as.disk()`).
|
||||||
|
|
||||||
With the `random_mic()` and `random_disk()` functions, we can generate sampled values for the new data types (S3 classes) `<mic>` and `<disk>`:
|
With the `random_mic()` and `random_disk()` functions, we can generate sampled values for the new data types (S3 classes) `<mic>` and `<disk>`:
|
||||||
|
|
||||||
@ -469,7 +491,7 @@ mic_values
|
|||||||
# base R:
|
# base R:
|
||||||
plot(mic_values)
|
plot(mic_values)
|
||||||
# ggplot2:
|
# ggplot2:
|
||||||
ggplot(mic_values)
|
autoplot(mic_values)
|
||||||
```
|
```
|
||||||
|
|
||||||
But we could also be more specific, by generating MICs that are likely to be found in *E. coli* for ciprofloxacin:
|
But we could also be more specific, by generating MICs that are likely to be found in *E. coli* for ciprofloxacin:
|
||||||
@ -478,7 +500,7 @@ But we could also be more specific, by generating MICs that are likely to be fou
|
|||||||
mic_values <- random_mic(size = 100, mo = "E. coli", ab = "cipro")
|
mic_values <- random_mic(size = 100, mo = "E. coli", ab = "cipro")
|
||||||
```
|
```
|
||||||
|
|
||||||
For the `plot()` and `ggplot()` function, we can define the microorganism and an antimicrobial agent the same way. This will add the interpretation of those values according to a chosen guidelines (defaults to the latest EUCAST guideline).
|
For the `plot()` and `autoplot()` function, we can define the microorganism and an antimicrobial agent the same way. This will add the interpretation of those values according to a chosen guidelines (defaults to the latest EUCAST guideline).
|
||||||
|
|
||||||
Default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red:
|
Default colours are colour-blind friendly, while maintaining the convention that e.g. 'susceptible' should be green and 'resistant' should be red:
|
||||||
|
|
||||||
@ -486,7 +508,7 @@ Default colours are colour-blind friendly, while maintaining the convention that
|
|||||||
# base R:
|
# base R:
|
||||||
plot(mic_values, mo = "E. coli", ab = "cipro")
|
plot(mic_values, mo = "E. coli", ab = "cipro")
|
||||||
# ggplot2:
|
# ggplot2:
|
||||||
ggplot(mic_values, mo = "E. coli", ab = "cipro")
|
autoplot(mic_values, mo = "E. coli", ab = "cipro")
|
||||||
```
|
```
|
||||||
|
|
||||||
For disk diffusion values, there is not much of a difference in plotting:
|
For disk diffusion values, there is not much of a difference in plotting:
|
||||||
@ -504,7 +526,7 @@ plot(disk_values, mo = "E. coli", ab = "cipro")
|
|||||||
And when using the `ggplot2` package, but now choosing the latest implemented CLSI guideline (notice that the EUCAST-specific term "Incr. exposure" has changed to "Intermediate"):
|
And when using the `ggplot2` package, but now choosing the latest implemented CLSI guideline (notice that the EUCAST-specific term "Incr. exposure" has changed to "Intermediate"):
|
||||||
|
|
||||||
```{r disk_plots_mo_ab, message = FALSE, warning = FALSE}
|
```{r disk_plots_mo_ab, message = FALSE, warning = FALSE}
|
||||||
ggplot(disk_values,
|
autoplot(disk_values,
|
||||||
mo = "E. coli",
|
mo = "E. coli",
|
||||||
ab = "cipro",
|
ab = "cipro",
|
||||||
guideline = "CLSI")
|
guideline = "CLSI")
|
||||||
|