1
0
mirror of https://github.com/msberends/AMR.git synced 2025-03-13 14:03:02 +01:00

Compare commits

..

No commits in common. "2dd06563558143622a306279d8fe2228ea06bea7" and "8fda473e49521f81708cbf59f03e9ed6ac5bc531" have entirely different histories.

102 changed files with 755 additions and 1050 deletions
DESCRIPTIONNAMESPACENEWS.md
R
data-raw
data
docs
index.md
man
tests/testthat

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.5.0.9018 Version: 1.5.0.9015
Date: 2021-02-09 Date: 2021-02-04
Title: Antimicrobial Resistance Data Analysis Title: Antimicrobial Resistance Data Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

@ -143,7 +143,6 @@ export(filter_first_weighted_isolate)
export(filter_fluoroquinolones) export(filter_fluoroquinolones)
export(filter_glycopeptides) export(filter_glycopeptides)
export(filter_macrolides) export(filter_macrolides)
export(filter_oxazolidinones)
export(filter_penicillins) export(filter_penicillins)
export(filter_tetracyclines) export(filter_tetracyclines)
export(first_isolate) export(first_isolate)
@ -212,7 +211,6 @@ export(mo_url)
export(mo_year) export(mo_year)
export(mrgn) export(mrgn)
export(n_rsi) export(n_rsi)
export(oxazolidinones)
export(p_symbol) export(p_symbol)
export(pca) export(pca)
export(penicillins) export(penicillins)

38
NEWS.md

@ -1,26 +1,30 @@
# AMR 1.5.0.9018 # AMR 1.5.0.9015
## <small>Last updated: 9 February 2021</small> ## <small>Last updated: 4 February 2021</small>
### New ### Breaking
* Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package. * Functions that are applied to a data set containing antibiotic columns gained the argument `only_rsi_columns`, which defaults to `TRUE` if any of the columns are of class `<rsi>` (i.e., transformed with `as.rsi()`). This increases reliability of automatic determination of antibiotic columns (so only columns that are defined to be `<rsi>` will be affected).
* Added function `eucast_dosage()` to get a `data.frame` with advised dosages of a certain bug-drug combination, which is based on the new `dosage` data set
* Added data set `dosage` to fuel the new `eucast_dosage()` function and to make this data available in a structured way This change might invalidate existing code. But since the new argument always returns `FALSE` when no `<rsi>` column can be found in the data, this chance is low.
* Existing data set `example_isolates` now reflects the latest EUCAST rules
* Added argument `only_rsi_columns` for some functions, which defaults to `FALSE`, to indicate if the functions must only be applied to columns that are of class `<rsi>` (i.e., transformed with `as.rsi()`). This increases speed since automatic determination of antibiotic columns is not needed anymore. Affected functions are: Affected functions are:
* All antibiotic selector functions (`ab_class()` and its wrappers, such as `aminoglocysides()`, `carbapenems()`, `penicillins()`) * All antibiotic selector functions (`ab_class()` and its wrappers, such as `aminoglocysides()`, `carbapenems()`, `penicillins()`)
* All antibiotic filter functions (`filter_ab_class()` and its wrappers, such as `filter_aminoglocysides()`, `filter_carbapenems()`, `filter_penicillins()`) * All antibiotic filter functions (`filter_ab_class()` and its wrappers, such as `filter_aminoglocysides()`, `filter_carbapenems()`, `filter_penicillins()`)
* `eucast_rules()` * `eucast_rules()`
* `mdro()` (including wrappers such as `brmo()`, `mrgn` and `eucast_exceptional_phenotypes()`) * `mdro()` (including wrappers such as `brmo()`, `mrgn` and `eucast_exceptional_phenotypes()`)
* `guess_ab_col()` * `guess_ab_col()`
* Functions `oxazolidinones()` (an antibiotic selector function) and `filter_oxazolidinones()` (an antibiotic filter function) to select/filter on e.g. linezolid and tedizolid
You can quickly transform all your eligible columns using either:
```r ```r
library(dplyr) library(dplyr)
x <- example_isolates %>% select(date, hospital_id, oxazolidinones()) your_date %>% mutate_if(is.rsi.eligible, as.rsi) # old dplyr
#> Selecting oxazolidinones: column 'LNZ' (linezolid) your_date %>% mutate(across((is.rsi.eligible), as.rsi)) # new dplyr
```
x <- example_isolates %>% filter_oxazolidinones()
#> Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I" ### New
``` * Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the `eucast_rules()` function and in `as.rsi()` to interpret MIC and disk diffusion values. This is now the default guideline in this package.
* Data set `dosage` to fuel the new `eucast_dosage()` function and to make this data available in a structured way
* Function `eucast_dosage()` to get a `data.frame` with advised dosages of a certain bug-drug combination, which is based on the new `dosage` data set
* Support for custom MDRO guidelines, using the new `custom_mdro_guideline()` function, please see `mdro()` for additional info * Support for custom MDRO guidelines, using the new `custom_mdro_guideline()` function, please see `mdro()` for additional info
* Function `isolate_identifier()`, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available. * Function `isolate_identifier()`, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.
* Function `mo_is_yeast()`, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales: * Function `mo_is_yeast()`, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:
@ -52,11 +56,11 @@
* WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V') * WHONET code `"PNV"` will now correctly be interpreted as `PHN`, the antibiotic code for phenoxymethylpenicillin ('peni V')
* Fix for verbose output of `mdro(..., verbose = TRUE)` for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only *P. aeruginosa*) * Fix for verbose output of `mdro(..., verbose = TRUE)` for German guideline (3MGRN and 4MGRN) and Dutch guideline (BRMO, only *P. aeruginosa*)
* `is.rsi.eligible()` now detects if the column name resembles an antibiotic name or code and now returns `TRUE` immediately if the input contains any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns. * `is.rsi.eligible()` now detects if the column name resembles an antibiotic name or code and now returns `TRUE` immediately if the input contains any of the values "R", "S" or "I". This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
* Functions `get_episode()` and `is_new_episode()` now support less than a day as value for argument `episode_days` (e.g., to include one patient/test per hour) * Functions `get_episode()` and `is_new_episode()` now support less than a day as value for argument `episode_days` (e.g., to include one patient/test per hour)
* Argument `ampc_cephalosporin_resistance` in `eucast_rules()` now also applies to value "I" (not only "S") * Argument `ampc_cephalosporin_resistance` in `eucast_rules()` now also applies to value "I" (not only "S")
* Updated colours of values R, S and I in tibble printing * Updated colours of values R, S and I in tibble printing
* Functions `print()` and `summary()` on a Principal Components Analysis object (`pca()`) now print additional group info if the original data was grouped using `dplyr::group_by()` * Functions `print()` and `summary()` on a Principal Components Analysis object (`pca()`) now print additional group info if the original data was grouped using `dplyr::group_by()`
* Improved speed and reliability of `guess_ab_col()`. As this also internally improves the reliability of `first_isolate()` and `mdro()`, this might have a slight impact on the results of those functions. * Improved speed of `guess_ab_col()`
### Other ### Other
* Big documentation updates * Big documentation updates

@ -675,18 +675,7 @@ get_current_data <- function(arg_name, call) {
# nothing worked, so: # nothing worked, so:
if (is.na(arg_name)) { if (is.na(arg_name)) {
if (isTRUE(is.numeric(call))) { stop_("this function must be used inside valid dplyr selection verbs or inside a data.frame call",
fn <- as.character(sys.call(call + 1)[1])
examples <- paste0(", e.g.:\n",
" your_data %>% select(", fn, "())\n",
" your_data %>% select(column_a, column_b, ", fn, "())\n",
" your_data[, ", fn, "()]\n",
' your_data[, c("column_a", "column_b", ', fn, "())]")
} else {
examples <- ""
}
stop_("this function must be used inside valid dplyr selection verbs or inside a data.frame call",
examples,
call = call) call = call)
} else { } else {
stop_("argument `", arg_name, "` is missing with no default", call = call) stop_("argument `", arg_name, "` is missing with no default", call = call)
@ -732,11 +721,6 @@ get_current_column <- function() {
} }
} }
is_null_or_grouped_tbl <- function(x) {
# attribute "grouped_df" might change at one point, so only set in one place; here.
is.null(x) || inherits(x, "grouped_df")
}
unique_call_id <- function(entire_session = FALSE) { unique_call_id <- function(entire_session = FALSE) {
if (entire_session == TRUE) { if (entire_session == TRUE) {
c(envir = "session", c(envir = "session",

@ -27,7 +27,7 @@
#' #'
#' These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}} #' These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
#' @inheritSection lifecycle Stable Lifecycle #' @inheritSection lifecycle Stable Lifecycle
#' @param only_rsi_columns a logical to indicate whether only columns of class [`<rsi>`]([rsi]) must be selected (defaults to `FALSE`) #' @param only_rsi_columns a logical to indicate whether only columns of class [`<rsi>`]([rsi]) must be selected. If set to `NULL` (default), it will be `TRUE` if any column of the data was [transformed to class `<rsi>`]([rsi]) on beforehand, and `FALSE` otherwise.
#' @inheritParams filter_ab_class #' @inheritParams filter_ab_class
#' @details \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}} #' @details \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}
#' #'
@ -81,91 +81,85 @@
#' example_isolates %>% filter(across(carbapenems(), ~. == "R")) #' example_isolates %>% filter(across(carbapenems(), ~. == "R"))
#' } #' }
ab_class <- function(ab_class, ab_class <- function(ab_class,
only_rsi_columns = FALSE) { only_rsi_columns = NULL) {
ab_selector(ab_class, function_name = "ab_class", only_rsi_columns = only_rsi_columns) ab_selector(ab_class, function_name = "ab_class", only_rsi_columns = only_rsi_columns)
} }
#' @rdname antibiotic_class_selectors #' @rdname antibiotic_class_selectors
#' @export #' @export
aminoglycosides <- function(only_rsi_columns = FALSE) { aminoglycosides <- function(only_rsi_columns = NULL) {
ab_selector("aminoglycoside", function_name = "aminoglycosides", only_rsi_columns = only_rsi_columns) ab_selector("aminoglycoside", function_name = "aminoglycosides", 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 = NULL) {
ab_selector("carbapenem", function_name = "carbapenems", only_rsi_columns = only_rsi_columns) ab_selector("carbapenem", function_name = "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 = NULL) {
ab_selector("cephalosporin", function_name = "cephalosporins", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporin", function_name = "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 = NULL) {
ab_selector("cephalosporins.*1", function_name = "cephalosporins_1st", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporins.*1", function_name = "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 = NULL) {
ab_selector("cephalosporins.*2", function_name = "cephalosporins_2nd", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporins.*2", function_name = "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 = NULL) {
ab_selector("cephalosporins.*3", function_name = "cephalosporins_3rd", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporins.*3", function_name = "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 = NULL) {
ab_selector("cephalosporins.*4", function_name = "cephalosporins_4th", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporins.*4", function_name = "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 = NULL) {
ab_selector("cephalosporins.*5", function_name = "cephalosporins_5th", only_rsi_columns = only_rsi_columns) ab_selector("cephalosporins.*5", function_name = "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 = NULL) {
ab_selector("fluoroquinolone", function_name = "fluoroquinolones", only_rsi_columns = only_rsi_columns) ab_selector("fluoroquinolone", function_name = "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 = NULL) {
ab_selector("glycopeptide", function_name = "glycopeptides", only_rsi_columns = only_rsi_columns) ab_selector("glycopeptide", function_name = "glycopeptides", 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 = NULL) {
ab_selector("macrolide", function_name = "macrolides", only_rsi_columns = only_rsi_columns) ab_selector("macrolide", function_name = "macrolides", only_rsi_columns = only_rsi_columns)
} }
#' @rdname antibiotic_class_selectors #' @rdname antibiotic_class_selectors
#' @export #' @export
oxazolidinones <- function(only_rsi_columns = FALSE) { penicillins <- function(only_rsi_columns = NULL) {
ab_selector("oxazolidinone", function_name = "oxazolidinones", only_rsi_columns = only_rsi_columns)
}
#' @rdname antibiotic_class_selectors
#' @export
penicillins <- function(only_rsi_columns = FALSE) {
ab_selector("penicillin", function_name = "penicillins", only_rsi_columns = only_rsi_columns) ab_selector("penicillin", function_name = "penicillins", 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 = NULL) {
ab_selector("tetracycline", function_name = "tetracyclines", only_rsi_columns = only_rsi_columns) ab_selector("tetracycline", function_name = "tetracyclines", only_rsi_columns = only_rsi_columns)
} }
@ -174,7 +168,7 @@ ab_selector <- function(ab_class,
only_rsi_columns) { only_rsi_columns) {
meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = 1) meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = 1)
meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1) meet_criteria(function_name, allow_class = "character", has_length = 1, .call_depth = 1)
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = 1) meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, allow_NULL = TRUE, .call_depth = 1)
if (as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2) { if (as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2) {
warning_("antibiotic class selectors such as ", function_name, warning_("antibiotic class selectors such as ", function_name,
@ -184,7 +178,9 @@ ab_selector <- function(ab_class,
} }
vars_df <- get_current_data(arg_name = NA, call = -3) vars_df <- get_current_data(arg_name = NA, call = -3)
if (is.null(only_rsi_columns)) {
only_rsi_columns <- any(is.rsi(vars_df))
}
# improve speed here so it will only run once when e.g. in one select call # improve speed here so it will only run once when e.g. in one select call
if (!identical(pkg_env$ab_selector, unique_call_id())) { if (!identical(pkg_env$ab_selector, unique_call_id())) {
ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns) ab_in_data <- get_column_abx(vars_df, info = FALSE, only_rsi_columns = only_rsi_columns)
@ -216,16 +212,14 @@ ab_selector <- function(ab_class,
if (length(agents) == 0) { if (length(agents) == 0) {
message_("No antimicrobial agents of class ", ab_group, " found", examples, ".") message_("No antimicrobial agents of class ", ab_group, " found", examples, ".")
} else { } else {
agents_formatted <- paste0("'", font_bold(agents, collapse = NULL), "'") agents_formatted <- paste0("column '", font_bold(agents, collapse = NULL), "'")
agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL) agents_names <- ab_name(names(agents), tolower = TRUE, language = NULL)
need_name <- tolower(gsub("[^a-zA-Z]", "", agents)) != tolower(gsub("[^a-zA-Z]", "", agents_names)) need_name <- tolower(gsub("[^a-zA-Z]", "", agents)) != tolower(gsub("[^a-zA-Z]", "", agents_names))
agents_formatted[need_name] <- paste0(agents_formatted[need_name], agents_formatted[need_name] <- paste0(agents_formatted[need_name],
" (", agents_names[need_name], ")") " (", agents_names[need_name], ")")
message_("Selecting ", ab_group, ": ", message_("Selecting ", ab_group, ": ", vector_and(agents_formatted, quotes = FALSE),
ifelse(length(agents) == 1, "column ", "columns "),
vector_and(agents_formatted, quotes = FALSE),
as_note = FALSE, as_note = FALSE,
extra_indent = 6) extra_indent = 4)
} }
remember_thrown_message(function_name) remember_thrown_message(function_name)
} }

@ -35,7 +35,7 @@
#' @param units a logical to indicate whether the units instead of the DDDs itself must be returned, see *Examples* #' @param units a logical to indicate whether the units instead of the DDDs itself must be returned, see *Examples*
#' @param open browse the URL using [utils::browseURL()] #' @param open browse the URL using [utils::browseURL()]
#' @param ... other arguments passed on to [as.ab()] #' @param ... other arguments passed on to [as.ab()]
#' @details All output [will be translated][translate] where possible. #' @details All output will be [translate]d where possible.
#' #'
#' The function [ab_url()] will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available. #' The function [ab_url()] will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.
#' @inheritSection as.ab Source #' @inheritSection as.ab Source

@ -78,7 +78,7 @@ format_eucast_version_nr <- function(version, markdown = TRUE) {
#' @param ... column name of an antibiotic, see section *Antibiotics* below #' @param ... column name of an antibiotic, see section *Antibiotics* below
#' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()] #' @param ab any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
#' @param administration route of administration, either `r vector_or(dosage$administration)` #' @param administration route of administration, either `r vector_or(dosage$administration)`
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`) #' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
#' @inheritParams first_isolate #' @inheritParams first_isolate
#' @details #' @details
#' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr #' **Note:** This function does not translate MIC values to RSI values. Use [as.rsi()] for that. \cr
@ -167,7 +167,7 @@ eucast_rules <- function(x,
version_breakpoints = 11.0, version_breakpoints = 11.0,
version_expertrules = 3.2, version_expertrules = 3.2,
ampc_cephalosporin_resistance = NA, ampc_cephalosporin_resistance = NA,
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
...) { ...) {
meet_criteria(x, allow_class = "data.frame") meet_criteria(x, allow_class = "data.frame")
meet_criteria(col_mo, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE) meet_criteria(col_mo, allow_class = "character", has_length = 1, is_in = colnames(x), allow_NULL = TRUE)
@ -282,7 +282,17 @@ eucast_rules <- function(x,
info = info, info = info,
only_rsi_columns = only_rsi_columns, only_rsi_columns = only_rsi_columns,
...) ...)
if (only_rsi_columns == TRUE && !paste0(sys.calls()[1], collapse = "") %like% "only_rsi_columns") {
cols_rsi_eligible <- colnames(x[, is.rsi.eligible(x), drop = FALSE])
if (length(cols_rsi_eligible) > 0) {
message_("These columns might be eligible for EUCAST rules, but are ignored since `only_rsi_columns` is `TRUE`: ",
vector_and(cols_rsi_eligible, quotes = TRUE, sort = FALSE),
as_note = TRUE, add_fn = font_red)
}
}
AMC <- cols_ab["AMC"] AMC <- cols_ab["AMC"]
AMK <- cols_ab["AMK"] AMK <- cols_ab["AMK"]
AMP <- cols_ab["AMP"] AMP <- cols_ab["AMP"]
@ -840,7 +850,7 @@ eucast_rules <- function(x,
# is new rule within group, print its name # is new rule within group, print its name
cat(markup_italics_where_needed(word_wrap(rule_current, cat(markup_italics_where_needed(word_wrap(rule_current,
width = getOption("width") - 30, width = getOption("width") - 30,
extra_indent = 6))) extra_indent = 4)))
warned <- FALSE warned <- FALSE
} }
} }

@ -31,7 +31,7 @@
#' @param ab_class an antimicrobial class, like `"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, like `"carbapenems"`. The columns `group`, `atc_group1` and `atc_group2` of the [antibiotics] data set will be searched (case-insensitive) for this value.
#' @param result an antibiotic result: S, I or R (or a combination of more of them) #' @param result an antibiotic result: S, I or R (or a combination of more of them)
#' @param scope the scope to check which variables to check, can be `"any"` (default) or `"all"` #' @param scope the scope to check which variables to check, can be `"any"` (default) or `"all"`
#' @param only_rsi_columns a logical to indicate whether only columns must be included that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`) #' @param only_rsi_columns a logical to indicate whether only columns must be included that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
#' @param ... arguments passed on to [filter_ab_class()] #' @param ... arguments passed on to [filter_ab_class()]
#' @details All columns of `x` will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. [filter_aminoglycosides()] will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc. #' @details All columns of `x` will be searched for known antibiotic names, abbreviations, brand names and codes (ATC, EARS-Net, WHO, etc.). This means that a filter function like e.g. [filter_aminoglycosides()] will include column names like 'gen', 'genta', 'J01GB03', 'tobra', 'Tobracin', etc.
#' @rdname filter_ab_class #' @rdname filter_ab_class
@ -82,7 +82,7 @@ filter_ab_class <- function(x,
ab_class, ab_class,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
...) { ...) {
.call_depth <- list(...)$`.call_depth` .call_depth <- list(...)$`.call_depth`
if (is.null(.call_depth)) { if (is.null(.call_depth)) {
@ -92,7 +92,6 @@ filter_ab_class <- function(x,
meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = .call_depth) meet_criteria(ab_class, allow_class = "character", has_length = 1, .call_depth = .call_depth)
meet_criteria(result, allow_class = "character", has_length = c(1, 2, 3), allow_NULL = TRUE, .call_depth = .call_depth) meet_criteria(result, allow_class = "character", has_length = c(1, 2, 3), allow_NULL = TRUE, .call_depth = .call_depth)
meet_criteria(scope, allow_class = "character", has_length = 1, is_in = c("all", "any"), .call_depth = .call_depth) meet_criteria(scope, allow_class = "character", has_length = 1, is_in = c("all", "any"), .call_depth = .call_depth)
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1, .call_depth = .call_depth)
check_dataset_integrity() check_dataset_integrity()
@ -111,7 +110,7 @@ filter_ab_class <- function(x,
stop_ifnot(all(scope %in% c("any", "all")), "`scope` must be one of: 'any', 'all'") stop_ifnot(all(scope %in% c("any", "all")), "`scope` must be one of: 'any', 'all'")
# get all columns in data with names that resemble antibiotics # get all columns in data with names that resemble antibiotics
ab_in_data <- get_column_abx(x, info = FALSE, only_rsi_columns = only_rsi_columns) ab_in_data <- get_column_abx(x, info = FALSE)
if (length(ab_in_data) == 0) { if (length(ab_in_data) == 0) {
message_("No columns with class <rsi> found (see ?as.rsi), data left unchanged.") message_("No columns with class <rsi> found (see ?as.rsi), data left unchanged.")
return(x.bak) return(x.bak)
@ -133,30 +132,31 @@ filter_ab_class <- function(x,
# get the columns with a group names in the chosen ab class # get the columns with a group names in the chosen ab class
agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab] agents <- ab_in_data[names(ab_in_data) %in% ab_reference$ab]
if (length(agents) == 0) { if (length(agents) == 0) {
message_("No antimicrobial agents of class ", ab_group, message_("no antimicrobial agents of class ", ab_group,
" found (such as ", find_ab_names(ab_class, 2), " found (such as ", find_ab_names(ab_class, 2),
")", "), data left unchanged.")
ifelse(only_rsi_columns == TRUE, " with class <rsi>,", ","),
" data left unchanged.")
return(x.bak) return(x.bak)
} }
if (length(result) == 1) {
operator <- " is "
} else {
operator <- " is one of "
}
if (scope == "any") { if (scope == "any") {
scope_txt <- " or " scope_txt <- " or "
scope_fn <- any scope_fn <- any
} else { } else {
scope_txt <- " and " scope_txt <- " and "
scope_fn <- all scope_fn <- all
if (length(agents) > 1) {
operator <- gsub("is", "are", operator)
}
} }
if (length(agents) > 1) { if (length(agents) > 1) {
operator <- " are" scope <- paste(scope, "of columns ")
scope <- paste("values in", scope, "of columns ")
} else { } else {
operator <- " is" scope <- "column "
scope <- "value in column "
}
if (length(result) > 1) {
operator <- paste(operator, "either")
} }
# sort columns on official name # sort columns on official name
@ -166,9 +166,7 @@ filter_ab_class <- function(x,
paste(paste0("`", font_bold(agents, collapse = NULL), paste(paste0("`", font_bold(agents, collapse = NULL),
"` (", ab_name(names(agents), tolower = TRUE, language = NULL), ")"), "` (", ab_name(names(agents), tolower = TRUE, language = NULL), ")"),
collapse = scope_txt), collapse = scope_txt),
operator, " ", vector_or(result, quotes = TRUE), operator, toString(result), as_note = FALSE)
as_note = FALSE,
extra_indent = 6)
x_transposed <- as.list(as.data.frame(t(x[, agents, drop = FALSE]), stringsAsFactors = FALSE)) x_transposed <- as.list(as.data.frame(t(x[, agents, drop = FALSE]), stringsAsFactors = FALSE))
filtered <- vapply(FUN.VALUE = logical(1), x_transposed, function(y) scope_fn(y %in% result, na.rm = TRUE)) filtered <- vapply(FUN.VALUE = logical(1), x_transposed, function(y) scope_fn(y %in% result, na.rm = TRUE))
x <- x[which(filtered), , drop = FALSE] x <- x[which(filtered), , drop = FALSE]
@ -181,13 +179,11 @@ filter_ab_class <- function(x,
filter_aminoglycosides <- function(x, filter_aminoglycosides <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "aminoglycoside", ab_class = "aminoglycoside",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -197,13 +193,11 @@ filter_aminoglycosides <- function(x,
filter_carbapenems <- function(x, filter_carbapenems <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "carbapenem", ab_class = "carbapenem",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -213,13 +207,11 @@ filter_carbapenems <- function(x,
filter_cephalosporins <- function(x, filter_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporin", ab_class = "cephalosporin",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -229,13 +221,11 @@ filter_cephalosporins <- function(x,
filter_1st_cephalosporins <- function(x, filter_1st_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporins (1st gen.)", ab_class = "cephalosporins (1st gen.)",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -245,13 +235,11 @@ filter_1st_cephalosporins <- function(x,
filter_2nd_cephalosporins <- function(x, filter_2nd_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporins (2nd gen.)", ab_class = "cephalosporins (2nd gen.)",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -261,13 +249,11 @@ filter_2nd_cephalosporins <- function(x,
filter_3rd_cephalosporins <- function(x, filter_3rd_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporins (3rd gen.)", ab_class = "cephalosporins (3rd gen.)",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -277,13 +263,11 @@ filter_3rd_cephalosporins <- function(x,
filter_4th_cephalosporins <- function(x, filter_4th_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporins (4th gen.)", ab_class = "cephalosporins (4th gen.)",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -293,13 +277,11 @@ filter_4th_cephalosporins <- function(x,
filter_5th_cephalosporins <- function(x, filter_5th_cephalosporins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "cephalosporins (5th gen.)", ab_class = "cephalosporins (5th gen.)",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -309,13 +291,11 @@ filter_5th_cephalosporins <- function(x,
filter_fluoroquinolones <- function(x, filter_fluoroquinolones <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "fluoroquinolone", ab_class = "fluoroquinolone",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -325,13 +305,11 @@ filter_fluoroquinolones <- function(x,
filter_glycopeptides <- function(x, filter_glycopeptides <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "glycopeptide", ab_class = "glycopeptide",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -341,29 +319,11 @@ filter_glycopeptides <- function(x,
filter_macrolides <- function(x, filter_macrolides <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "macrolide", ab_class = "macrolide",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1,
...)
}
#' @rdname filter_ab_class
#' @export
filter_oxazolidinones <- function(x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...) {
filter_ab_class(x = x,
ab_class = "oxazolidinone",
result = result,
scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -373,13 +333,11 @@ filter_oxazolidinones <- function(x,
filter_penicillins <- function(x, filter_penicillins <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "penicillin", ab_class = "penicillin",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -389,13 +347,11 @@ filter_penicillins <- function(x,
filter_tetracyclines <- function(x, filter_tetracyclines <- function(x,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE,
...) { ...) {
filter_ab_class(x = x, filter_ab_class(x = x,
ab_class = "tetracycline", ab_class = "tetracycline",
result = result, result = result,
scope = scope, scope = scope,
only_rsi_columns = only_rsi_columns,
.call_depth = 1, .call_depth = 1,
...) ...)
} }
@ -408,7 +364,6 @@ find_ab_group <- function(ab_class) {
"fluoroquinolone", "fluoroquinolone",
"glycopeptide", "glycopeptide",
"macrolide", "macrolide",
"oxazolidinone",
"tetracycline"), "tetracycline"),
paste0(ab_class, "s"), paste0(ab_class, "s"),
antibiotics %pm>% antibiotics %pm>%

@ -27,7 +27,7 @@
#' #'
#' Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package. #' Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package.
#' @inheritSection lifecycle Stable Lifecycle #' @inheritSection lifecycle Stable Lifecycle
#' @param x a [data.frame] containing isolates. Can be left blank for automatic determination, see *Examples*. #' @param x a [data.frame] containing isolates. Can be left blank for automatic determination.
#' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class #' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class
#' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive) #' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive)
#' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()]. #' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()].
@ -86,7 +86,7 @@
#' #'
#' 2. Using `type = "points"` and argument `points_threshold` #' 2. Using `type = "points"` and argument `points_threshold`
#' #'
#' A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds `points_threshold`, which defaults to `2`, an isolate will be (re)selected as a first weighted isolate. #' A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds `points_threshold`, which default to `2`, an isolate will be (re)selected as a first weighted isolate.
#' @rdname first_isolate #' @rdname first_isolate
#' @seealso [key_antibiotics()] #' @seealso [key_antibiotics()]
#' @export #' @export
@ -99,12 +99,10 @@
#' # `example_isolates` is a data set available in the AMR package. #' # `example_isolates` is a data set available in the AMR package.
#' # See ?example_isolates. #' # See ?example_isolates.
#' #'
#' example_isolates[first_isolate(example_isolates), ] #' # basic filtering on first isolates
#'
#' \donttest{
#' # faster way, only works in R 3.2 and later:
#' example_isolates[first_isolate(), ] #' example_isolates[first_isolate(), ]
#' #'
#' \donttest{
#' # get all first Gram-negatives #' # get all first Gram-negatives
#' example_isolates[which(first_isolate() & mo_is_gram_negative()), ] #' example_isolates[which(first_isolate() & mo_is_gram_negative()), ]
#' #'
@ -142,7 +140,7 @@
#' # when you (erroneously) would have used all isolates for analysis. #' # when you (erroneously) would have used all isolates for analysis.
#' } #' }
#' } #' }
first_isolate <- function(x = NULL, first_isolate <- function(x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
@ -160,10 +158,8 @@ first_isolate <- function(x = NULL,
info = interactive(), info = interactive(),
include_unknown = FALSE, include_unknown = FALSE,
...) { ...) {
if (is_null_or_grouped_tbl(x)) { if (missing(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all()) x <- get_current_data(arg_name = "x", call = -2)
# is also fix for using a grouped df as input (a dot as first argument)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
} }
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0 meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
@ -189,9 +185,6 @@ first_isolate <- function(x = NULL,
meet_criteria(info, allow_class = "logical", has_length = 1) meet_criteria(info, allow_class = "logical", has_length = 1)
meet_criteria(include_unknown, allow_class = "logical", has_length = 1) meet_criteria(include_unknown, allow_class = "logical", has_length = 1)
# remove data.table, grouping from tibbles, etc.
x <- as.data.frame(x, stringsAsFactors = FALSE)
dots <- unlist(list(...)) dots <- unlist(list(...))
if (length(dots) != 0) { if (length(dots) != 0) {
# backwards compatibility with old arguments # backwards compatibility with old arguments
@ -204,7 +197,18 @@ first_isolate <- function(x = NULL,
} }
} }
# try to find columns based on type # fix for using a grouped df as input (a dot as first argument)
# such as example_isolates %>% group_by(hospital_id) %>% mutate(first_isolate = first_isolate(.))
if (inherits(x, "grouped_df")) {
# get_current_data() contains dplyr::cur_data_all()
x <- tryCatch(get_current_data(arg_name = "x", 0),
error = function(e) x)
}
# remove data.table, grouping from tibbles, etc.
x <- as.data.frame(x, stringsAsFactors = FALSE)
# try to find columns based on type
# -- mo # -- mo
if (is.null(col_mo)) { if (is.null(col_mo)) {
col_mo <- search_type_in_df(x = x, type = "mo") col_mo <- search_type_in_df(x = x, type = "mo")
@ -506,21 +510,15 @@ first_isolate <- function(x = NULL,
#' @rdname first_isolate #' @rdname first_isolate
#' @export #' @export
filter_first_isolate <- function(x = NULL, filter_first_isolate <- function(x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
...) { ...) {
if (is_null_or_grouped_tbl(x)) { meet_criteria(x, allow_class = "data.frame")
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
}
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_patient_id, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_patient_id, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
subset(x, first_isolate(x = x, subset(x, first_isolate(x = x,
col_date = col_date, col_date = col_date,
col_patient_id = col_patient_id, col_patient_id = col_patient_id,
@ -530,23 +528,17 @@ filter_first_isolate <- function(x = NULL,
#' @rdname first_isolate #' @rdname first_isolate
#' @export #' @export
filter_first_weighted_isolate <- function(x = NULL, filter_first_weighted_isolate <- function(x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
col_keyantibiotics = NULL, col_keyantibiotics = NULL,
...) { ...) {
if (is_null_or_grouped_tbl(x)) { meet_criteria(x, allow_class = "data.frame")
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all())
# is also fix for using a grouped df as input (a dot as first argument)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
}
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0
meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_date, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_patient_id, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_patient_id, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
meet_criteria(col_keyantibiotics, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x)) meet_criteria(col_keyantibiotics, allow_class = "character", has_length = 1, allow_NULL = TRUE, is_in = colnames(x))
y <- x y <- x
if (is.null(col_keyantibiotics)) { if (is.null(col_keyantibiotics)) {
# first try to look for it # first try to look for it

@ -30,7 +30,7 @@
#' @param x a [data.frame] #' @param x a [data.frame]
#' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x` #' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x`
#' @param verbose a logical to indicate whether additional info should be printed #' @param verbose a logical to indicate whether additional info should be printed
#' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand (defaults to `FALSE`) #' @param only_rsi_columns a logical to indicate whether only antibiotic columns must be detected that were [transformed to class `<rsi>`]([rsi]) on beforehand. Defaults to `TRUE` if any column of `x` is of class `<rsi>`.
#' @details You can look for an antibiotic (trade) name or abbreviation and it will search `x` and the [antibiotics] data set for any column containing a name or code of that antibiotic. **Longer columns names take precedence over shorter column names.** #' @details You can look for an antibiotic (trade) name or abbreviation and it will search `x` and the [antibiotics] data set for any column containing a name or code of that antibiotic. **Longer columns names take precedence over shorter column names.**
#' @return A column name of `x`, or `NULL` when no result is found. #' @return A column name of `x`, or `NULL` when no result is found.
#' @export #' @export
@ -63,7 +63,7 @@
#' AMP_ED20 = "S") #' AMP_ED20 = "S")
#' guess_ab_col(df, "ampicillin") #' guess_ab_col(df, "ampicillin")
#' # [1] "AMP_ED20" #' # [1] "AMP_ED20"
guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_rsi_columns = FALSE) { guess_ab_col <- function(x = NULL, search_string = NULL, verbose = FALSE, only_rsi_columns = any(is.rsi(x))) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE)
meet_criteria(search_string, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(search_string, allow_class = "character", has_length = 1, allow_NULL = TRUE)
meet_criteria(verbose, allow_class = "logical", has_length = 1) meet_criteria(verbose, allow_class = "logical", has_length = 1)

@ -108,7 +108,7 @@
#' sum(my_patients$first_weighted, na.rm = TRUE) #' sum(my_patients$first_weighted, na.rm = TRUE)
#' } #' }
#' } #' }
key_antibiotics <- function(x = NULL, key_antibiotics <- function(x,
col_mo = NULL, col_mo = NULL,
universal_1 = guess_ab_col(x, "amoxicillin"), universal_1 = guess_ab_col(x, "amoxicillin"),
universal_2 = guess_ab_col(x, "amoxicillin/clavulanic acid"), universal_2 = guess_ab_col(x, "amoxicillin/clavulanic acid"),
@ -130,12 +130,10 @@ key_antibiotics <- function(x = NULL,
GramNeg_6 = guess_ab_col(x, "meropenem"), GramNeg_6 = guess_ab_col(x, "meropenem"),
warnings = TRUE, warnings = TRUE,
...) { ...) {
if (is_null_or_grouped_tbl(x)) { if (missing(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all()) x <- get_current_data(arg_name = "x", call = -2)
# is also fix for using a grouped df as input (a dot as first argument)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
} }
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0 meet_criteria(x, allow_class = "data.frame")
meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE) meet_criteria(col_mo, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
meet_criteria(universal_1, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE) meet_criteria(universal_1, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
meet_criteria(universal_2, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE) meet_criteria(universal_2, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
@ -157,9 +155,6 @@ key_antibiotics <- function(x = NULL,
meet_criteria(GramNeg_6, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE) meet_criteria(GramNeg_6, allow_class = "character", has_length = 1, allow_NULL = TRUE, allow_NA = TRUE)
meet_criteria(warnings, allow_class = "logical", has_length = 1) meet_criteria(warnings, allow_class = "logical", has_length = 1)
# force regular data.frame, not a tibble or data.table
x <- as.data.frame(x, stringsAsFactors = FALSE)
dots <- unlist(list(...)) dots <- unlist(list(...))
if (length(dots) != 0) { if (length(dots) != 0) {
# backwards compatibility with old arguments # backwards compatibility with old arguments
@ -254,6 +249,7 @@ key_antibiotics <- function(x = NULL,
remember_thrown_message("key_antibiotics.gramneg") remember_thrown_message("key_antibiotics.gramneg")
} }
x <- as.data.frame(x, stringsAsFactors = FALSE)
x[, col_mo] <- as.mo(x[, col_mo, drop = TRUE]) x[, col_mo] <- as.mo(x[, col_mo, drop = TRUE])
x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL) x$gramstain <- mo_gramstain(x[, col_mo, drop = TRUE], language = NULL)
x$key_ab <- NA_character_ x$key_ab <- NA_character_

171
R/mdro.R

@ -146,21 +146,19 @@
#' MRGN = mrgn()) #' MRGN = mrgn())
#' } #' }
#' } #' }
mdro <- function(x = NULL, mdro <- function(x,
guideline = "CMI2012", guideline = "CMI2012",
col_mo = NULL, col_mo = NULL,
info = interactive(), info = interactive(),
pct_required_classes = 0.5, pct_required_classes = 0.5,
combine_SI = TRUE, combine_SI = TRUE,
verbose = FALSE, verbose = FALSE,
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
...) { ...) {
if (is_null_or_grouped_tbl(x)) { if (missing(x)) {
# when `x` is left blank, auto determine it (get_current_data() also contains dplyr::cur_data_all()) x <- get_current_data(arg_name = "x", call = -2)
# is also fix for using a grouped df as input (a dot as first argument)
x <- tryCatch(get_current_data(arg_name = "x", call = -2), error = function(e) x)
} }
meet_criteria(x, allow_class = "data.frame") # also checks dimensions to be >0 meet_criteria(x, allow_class = "data.frame")
meet_criteria(guideline, allow_class = c("list", "character"), allow_NULL = TRUE) meet_criteria(guideline, allow_class = c("list", "character"), allow_NULL = TRUE)
if (!is.list(guideline)) { if (!is.list(guideline)) {
meet_criteria(guideline, allow_class = "character", has_length = 1, allow_NULL = TRUE) meet_criteria(guideline, allow_class = "character", has_length = 1, allow_NULL = TRUE)
@ -170,18 +168,9 @@ mdro <- function(x = NULL,
meet_criteria(pct_required_classes, allow_class = "numeric", has_length = 1) meet_criteria(pct_required_classes, allow_class = "numeric", has_length = 1)
meet_criteria(combine_SI, allow_class = "logical", has_length = 1) meet_criteria(combine_SI, allow_class = "logical", has_length = 1)
meet_criteria(verbose, allow_class = "logical", has_length = 1) meet_criteria(verbose, allow_class = "logical", has_length = 1)
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1)
check_dataset_integrity() check_dataset_integrity()
info.bak <- info
if (message_not_thrown_before("mdro")) {
remember_thrown_message("mdro")
} else {
# don't thrown info's more than once per call
info <- FALSE
}
if (interactive() & verbose == TRUE & info == TRUE) { if (interactive() & verbose == TRUE & info == TRUE) {
txt <- paste0("WARNING: In Verbose mode, the mdro() function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.", txt <- paste0("WARNING: In Verbose mode, the mdro() function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.",
"\n\nThis may overwrite your existing data if you use e.g.:", "\n\nThis may overwrite your existing data if you use e.g.:",
@ -198,31 +187,10 @@ mdro <- function(x = NULL,
} }
} }
group_msg <- ""
if (info.bak == TRUE) {
# print group name if used in dplyr::group_by()
cur_group <- import_fn("cur_group", "dplyr", error_on_fail = FALSE)
if (!is.null(cur_group)) {
group_df <- tryCatch(cur_group(), error = function(e) data.frame())
if (NCOL(group_df) > 0) {
# transform factors to characters
group <- vapply(FUN.VALUE = character(1), group_df, function(x) {
if (is.numeric(x)) {
format(x)
} else if (is.logical(x)) {
as.character(x)
} else {
paste0('"', x, '"')
}
})
group_msg <- paste0("\nGroup: ", paste0(names(group), " = ", group, collapse = ", "), "\n")
}
}
}
# force regular data.frame, not a tibble or data.table # force regular data.frame, not a tibble or data.table
x <- as.data.frame(x, stringsAsFactors = FALSE) x <- as.data.frame(x, stringsAsFactors = FALSE)
stop_ifnot(is.numeric(pct_required_classes), "`pct_required_classes` must be numeric")
if (pct_required_classes > 1) { if (pct_required_classes > 1) {
# allow pct_required_classes = 75 -> pct_required_classes = 0.75 # allow pct_required_classes = 75 -> pct_required_classes = 0.75
pct_required_classes <- pct_required_classes / 100 pct_required_classes <- pct_required_classes / 100
@ -247,8 +215,7 @@ mdro <- function(x = NULL,
cat(txt, "\n", sep = "") cat(txt, "\n", sep = "")
} }
x <- run_custom_mdro_guideline(x, guideline) x <- run_custom_mdro_guideline(x, guideline)
if (info.bak == TRUE) { if (info == TRUE) {
cat(group_msg)
if (sum(!is.na(x$MDRO)) == 0) { if (sum(!is.na(x$MDRO)) == 0) {
cat(word_wrap(font_bold(paste0("=> Found 0 MDROs since no isolates are covered by the custom guideline")))) cat(word_wrap(font_bold(paste0("=> Found 0 MDROs since no isolates are covered by the custom guideline"))))
} else { } else {
@ -529,7 +496,16 @@ mdro <- function(x = NULL,
only_rsi_columns = only_rsi_columns, only_rsi_columns = only_rsi_columns,
...) ...)
} }
if (only_rsi_columns == TRUE) {
cols_rsi_eligible <- colnames(x[, is.rsi.eligible(x), drop = FALSE])
if (length(cols_rsi_eligible) > 0) {
message_("These columns might be eligible for determining ", guideline$type, ", but are ignored since `only_rsi_columns` is `TRUE`: ",
vector_and(cols_rsi_eligible, quotes = TRUE, sort = FALSE),
as_note = TRUE, add_fn = font_red)
}
}
# nolint start # nolint start
AMC <- cols_ab["AMC"] AMC <- cols_ab["AMC"]
AMK <- cols_ab["AMK"] AMK <- cols_ab["AMK"]
@ -1365,8 +1341,7 @@ mdro <- function(x = NULL,
x$reason <- "PDR/MDR/XDR criteria were met" x$reason <- "PDR/MDR/XDR criteria were met"
} }
if (info.bak == TRUE) { if (info == TRUE) {
cat(group_msg)
if (sum(!is.na(x$MDRO)) == 0) { if (sum(!is.na(x$MDRO)) == 0) {
cat(font_bold(paste0("=> Found 0 MDROs since no isolates are covered by the guideline"))) cat(font_bold(paste0("=> Found 0 MDROs since no isolates are covered by the guideline")))
} else { } else {
@ -1387,11 +1362,8 @@ mdro <- function(x = NULL,
# Results ---- # Results ----
if (guideline$code == "cmi2012") { if (guideline$code == "cmi2012") {
if (any(x$MDRO == -1, na.rm = TRUE)) { if (any(x$MDRO == -1, na.rm = TRUE)) {
if (message_not_thrown_before("mdro.availability")) { warning_("NA introduced for isolates where the available percentage of antimicrobial classes was below ",
warning_("NA introduced for isolates where the available percentage of antimicrobial classes was below ", percentage(pct_required_classes), " (set with `pct_required_classes`)", call = FALSE)
percentage(pct_required_classes), " (set with `pct_required_classes`)", call = FALSE)
remember_thrown_message("mdro.availability")
}
# set these -1s to NA # set these -1s to NA
x[which(x$MDRO == -1), "MDRO"] <- NA_integer_ x[which(x$MDRO == -1), "MDRO"] <- NA_integer_
} }
@ -1451,12 +1423,12 @@ custom_mdro_guideline <- function(..., as_factor = TRUE) {
qry <- as.expression(qry) qry <- as.expression(qry)
} }
qry <- as.character(qry) qry <- as.character(qry)
# these will prevent vectorisation, so replace them: # these will prevent vectorisaton, so replace them:
qry <- gsub("&&", "&", qry, fixed = TRUE) qry <- gsub("&&", "&", qry, fixed = TRUE)
qry <- gsub("||", "|", qry, fixed = TRUE) qry <- gsub("||", "|", qry, fixed = TRUE)
# support filter()-like writing: custom_mdro_guideline('CIP == "R", AMX == "S"' ~ "result 1") # support filter()-like writing: custom_mdro_guideline('CIP == "R", AMX == "S"' ~ "result 1")
qry <- gsub(" *, *", " & ", qry) qry <- gsub(" *, *", " & ", qry)
# format nicely, setting spaces around operators # format nicely
qry <- gsub(" *([&|+-/*^><==]+) *", " \\1 ", qry) qry <- gsub(" *([&|+-/*^><==]+) *", " \\1 ", qry)
qry <- gsub("'", "\"", qry, fixed = TRUE) qry <- gsub("'", "\"", qry, fixed = TRUE)
out[[i]]$query <- as.expression(qry) out[[i]]$query <- as.expression(qry)
@ -1482,23 +1454,21 @@ print.custom_mdro_guideline <- function(x, ...) {
cat("A set of custom MDRO rules:\n") cat("A set of custom MDRO rules:\n")
for (i in seq_len(length(x))) { for (i in seq_len(length(x))) {
rule <- x[[i]] rule <- x[[i]]
rule$query <- gsub(" & ", font_black(font_italic(" and ")), rule$query, fixed = TRUE) rule$query <- gsub(" & ", " and ", rule$query, fixed = TRUE)
rule$query <- gsub(" | ", font_black(" or "), rule$query, fixed = TRUE) rule$query <- gsub(" | ", " or ", rule$query, fixed = TRUE)
rule$query <- gsub(" + ", font_black(" plus "), rule$query, fixed = TRUE) rule$query <- gsub(" + ", " plus ", rule$query, fixed = TRUE)
rule$query <- gsub(" - ", font_black(" minus "), rule$query, fixed = TRUE) rule$query <- gsub(" - ", " minus ", rule$query, fixed = TRUE)
rule$query <- gsub(" / ", font_black(" divided by "), rule$query, fixed = TRUE) rule$query <- gsub(" / ", " divided by ", rule$query, fixed = TRUE)
rule$query <- gsub(" * ", font_black(" times "), rule$query, fixed = TRUE) rule$query <- gsub(" * ", " times ", rule$query, fixed = TRUE)
rule$query <- gsub(" == ", font_black(" is "), rule$query, fixed = TRUE) rule$query <- gsub(" == ", " is ", rule$query, fixed = TRUE)
rule$query <- gsub(" > ", font_black(" is higher than "), rule$query, fixed = TRUE) rule$query <- gsub(" > ", " is higher than ", rule$query, fixed = TRUE)
rule$query <- gsub(" < ", font_black(" is lower than "), rule$query, fixed = TRUE) rule$query <- gsub(" < ", " is lower than ", rule$query, fixed = TRUE)
rule$query <- gsub(" >= ", font_black(" is higher than or equal to "), rule$query, fixed = TRUE) rule$query <- gsub(" >= ", " is higher than or equal to ", rule$query, fixed = TRUE)
rule$query <- gsub(" <= ", font_black(" is lower than or equal to "), rule$query, fixed = TRUE) rule$query <- gsub(" <= ", " is lower than or equal to ", rule$query, fixed = TRUE)
rule$query <- gsub(" ^ ", font_black(" to the power of "), rule$query, fixed = TRUE) rule$query <- gsub(" ^ ", " to the power of ", rule$query, fixed = TRUE)
# replace the black colour 'stops' with blue colour 'starts' cat(" ", i, ". ", font_blue(as.character(rule$query)), " -> ", font_red(rule$value), "\n", sep = "")
rule$query <- gsub("\033[39m", "\033[34m", as.character(rule$query), fixed = TRUE)
cat(" ", i, ". ", font_blue(rule$query), font_bold(" -> "), font_red(rule$value), "\n", sep = "")
} }
cat(" ", i + 1, ". Otherwise", font_bold(" -> "), font_red(paste0("Negative")), "\n", sep = "") cat(" ", i + 1, ". Otherwise -> ", font_red(paste0("Negative")), "\n", sep = "")
cat("\nUnmatched rows will return ", font_red("NA"), ".\n", sep = "") cat("\nUnmatched rows will return ", font_red("NA"), ".\n", sep = "")
if (isTRUE(attributes(x)$as_factor)) { if (isTRUE(attributes(x)$as_factor)) {
cat("Results will be of class <factor>, with ordered levels: ", paste0(attributes(x)$values, collapse = " < "), "\n", sep = "") cat("Results will be of class <factor>, with ordered levels: ", paste0(attributes(x)$values, collapse = " < "), "\n", sep = "")
@ -1519,9 +1489,7 @@ run_custom_mdro_guideline <- function(df, guideline) {
return("error") return("error")
}) })
if (identical(qry, "error")) { if (identical(qry, "error")) {
warning_("in custom_mdro_guideline(): rule ", i, warning_("in custom_mdro_guideline(): rule ", i, " (`", guideline[[i]]$query, "`) was ignored because of this error message: ", pkg_env$err_msg,
" (`", guideline[[i]]$query, "`) was ignored because of this error message: ",
pkg_env$err_msg,
call = FALSE, call = FALSE,
add_fn = font_red) add_fn = font_red)
next next
@ -1556,50 +1524,55 @@ run_custom_mdro_guideline <- function(df, guideline) {
#' @rdname mdro #' @rdname mdro
#' @export #' @export
brmo <- function(x = NULL, only_rsi_columns = FALSE, ...) { brmo <- function(x, guideline = "BRMO", only_rsi_columns = any(is.rsi(x)), ...) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) if (missing(x)) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) x <- get_current_data(arg_name = "x", call = -2)
stop_if("guideline" %in% names(list(...)), }
"argument `guideline` must not be set since this is a guideline-specific function") meet_criteria(x, allow_class = "data.frame")
mdro(x = x, only_rsi_columns = only_rsi_columns, guideline = "BRMO", ...) meet_criteria(guideline, allow_class = "character", has_length = 1)
mdro(x, guideline = "BRMO", only_rsi_columns = only_rsi_columns, ...)
} }
#' @rdname mdro #' @rdname mdro
#' @export #' @export
mrgn <- function(x = NULL, only_rsi_columns = FALSE, ...) { mrgn <- function(x, guideline = "MRGN", only_rsi_columns = any(is.rsi(x)), ...) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) if (missing(x)) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) x <- get_current_data(arg_name = "x", call = -2)
stop_if("guideline" %in% names(list(...)), }
"argument `guideline` must not be set since this is a guideline-specific function") meet_criteria(x, allow_class = "data.frame")
mdro(x = x, only_rsi_columns = only_rsi_columns, guideline = "MRGN", ...) meet_criteria(guideline, allow_class = "character", has_length = 1)
mdro(x = x, guideline = "MRGN", only_rsi_columns = only_rsi_columns, ...)
} }
#' @rdname mdro #' @rdname mdro
#' @export #' @export
mdr_tb <- function(x = NULL, only_rsi_columns = FALSE, ...) { mdr_tb <- function(x, guideline = "TB", only_rsi_columns = any(is.rsi(x)), ...) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) if (missing(x)) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) x <- get_current_data(arg_name = "x", call = -2)
stop_if("guideline" %in% names(list(...)), }
"argument `guideline` must not be set since this is a guideline-specific function") meet_criteria(x, allow_class = "data.frame")
mdro(x = x, only_rsi_columns = only_rsi_columns, guideline = "TB", ...) meet_criteria(guideline, allow_class = "character", has_length = 1)
mdro(x = x, guideline = "TB", only_rsi_columns = only_rsi_columns, ...)
} }
#' @rdname mdro #' @rdname mdro
#' @export #' @export
mdr_cmi2012 <- function(x = NULL, only_rsi_columns = FALSE, ...) { mdr_cmi2012 <- function(x, guideline = "CMI2012", only_rsi_columns = any(is.rsi(x)), ...) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) if (missing(x)) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) x <- get_current_data(arg_name = "x", call = -2)
stop_if("guideline" %in% names(list(...)), }
"argument `guideline` must not be set since this is a guideline-specific function") meet_criteria(x, allow_class = "data.frame")
mdro(x = x, only_rsi_columns = only_rsi_columns, guideline = "CMI2012", ...) meet_criteria(guideline, allow_class = "character", has_length = 1)
mdro(x = x, guideline = "CMI2012", only_rsi_columns = only_rsi_columns, ...)
} }
#' @rdname mdro #' @rdname mdro
#' @export #' @export
eucast_exceptional_phenotypes <- function(x = NULL, only_rsi_columns = FALSE, ...) { eucast_exceptional_phenotypes <- function(x, guideline = "EUCAST", only_rsi_columns = any(is.rsi(x)), ...) {
meet_criteria(x, allow_class = "data.frame", allow_NULL = TRUE) if (missing(x)) {
meet_criteria(only_rsi_columns, allow_class = "logical", has_length = 1) x <- get_current_data(arg_name = "x", call = -2)
stop_if("guideline" %in% names(list(...)), }
"argument `guideline` must not be set since this is a guideline-specific function") meet_criteria(x, allow_class = "data.frame")
mdro(x = x, only_rsi_columns = only_rsi_columns, guideline = "EUCAST", ...) meet_criteria(guideline, allow_class = "character", has_length = 1)
mdro(x = x, guideline = "EUCAST", only_rsi_columns = only_rsi_columns, ...)
} }

@ -44,11 +44,11 @@
#' #'
#' The Gram stain - [mo_gramstain()] - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, [PMID 11837318](https://pubmed.ncbi.nlm.nih.gov/11837318)), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. Functions [mo_is_gram_negative()] and [mo_is_gram_positive()] always return `TRUE` or `FALSE` (except when the input is `NA` or the MO code is `UNKNOWN`), thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria. #' The Gram stain - [mo_gramstain()] - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, [PMID 11837318](https://pubmed.ncbi.nlm.nih.gov/11837318)), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value `NA`. Functions [mo_is_gram_negative()] and [mo_is_gram_positive()] always return `TRUE` or `FALSE` (except when the input is `NA` or the MO code is `UNKNOWN`), thus always return `FALSE` for species outside the taxonomic kingdom of Bacteria.
#' #'
#' Determination of yeasts - [mo_is_yeast()] - will be based on the taxonomic kingdom and class. *Budding yeasts* are fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). *True yeasts* are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are fungi and member of the taxonomic class Saccharomycetes, the function will return `TRUE`. It returns `FALSE` otherwise (except when the input is `NA` or the MO code is `UNKNOWN`). #' Determination of yeasts - [mo_is_yeast()] - will be based on the taxonomic phylum, class and order. Budding yeasts are true fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). The true yeasts are separated into one main order Saccharomycetales. For all microorganisms that are in one of those two groups, the function will return `TRUE`. It returns `FALSE` for all other taxonomic entries.
#' #'
#' Intrinsic resistance - [mo_is_intrinsic_resistant()] - will be determined based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.2)`. The [mo_is_intrinsic_resistant()] functions can be vectorised over arguments `x` (input for microorganisms) and over `ab` (input for antibiotics). #' Intrinsic resistance - [mo_is_intrinsic_resistant()] - will be determined based on the [intrinsic_resistant] data set, which is based on `r format_eucast_version_nr(3.2)`. The [mo_is_intrinsic_resistant()] can be vectorised over arguments `x` (input for microorganisms) and over `ab` (input for antibiotics).
#' #'
#' All output [will be translated][translate] where possible. #' All output will be [translate]d where possible.
#' #'
#' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species. #' The function [mo_url()] will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
#' @inheritSection mo_matching_score Matching Score for Microorganisms #' @inheritSection mo_matching_score Matching Score for Microorganisms
@ -438,7 +438,8 @@ mo_is_yeast <- function(x, language = get_locale(), ...) {
load_mo_failures_uncertainties_renamed(metadata) load_mo_failures_uncertainties_renamed(metadata)
out <- rep(FALSE, length(x)) out <- rep(FALSE, length(x))
out[x.kingdom == "Fungi" & x.class == "Saccharomycetes"] <- TRUE out[x.kingdom == "Fungi" &
((x.phylum == "Ascomycetes" & x.class == "Saccharomycetes") | x.order == "Saccharomycetales")] <- TRUE
out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA out[x.mo %in% c(NA_character_, "UNKNOWN")] <- NA
out out
} }

@ -204,7 +204,6 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
meet_criteria(threshold, allow_class = "numeric", has_length = 1) meet_criteria(threshold, allow_class = "numeric", has_length = 1)
if (inherits(x, "data.frame")) { if (inherits(x, "data.frame")) {
# iterate this function over all columns
return(unname(vapply(FUN.VALUE = logical(1), x, is.rsi.eligible))) return(unname(vapply(FUN.VALUE = logical(1), x, is.rsi.eligible)))
} }
@ -236,8 +235,6 @@ is.rsi.eligible <- function(x, threshold = 0.05) {
ab <- suppressWarnings(as.ab(cur_col, fast_mode = TRUE, info = FALSE)) ab <- suppressWarnings(as.ab(cur_col, fast_mode = TRUE, info = FALSE))
if (!is.na(ab)) { if (!is.na(ab)) {
# this is a valid antibiotic code # this is a valid antibiotic code
message_("Column '", font_bold(cur_col), "' is as.rsi()-eligible (despite only having empty values), since it seems to be ",
ab_name(ab, language = NULL, tolower = TRUE), " (", ab, ")")
return(TRUE) return(TRUE)
} }
} }

Binary file not shown.

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

@ -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.5.0.9018</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -193,7 +193,7 @@
<h1 data-toc-skip>How to conduct AMR data analysis</h1> <h1 data-toc-skip>How to conduct AMR data analysis</h1>
<h4 class="author">Matthijs S. Berends</h4> <h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">09 February 2021</h4> <h4 class="date">02 February 2021</h4>
<small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small> <small class="dont-index">Source: <a href="https://github.com/msberends/AMR/blob/master/vignettes/AMR.Rmd"><code>vignettes/AMR.Rmd</code></a></small>
<div class="hidden name"><code>AMR.Rmd</code></div> <div class="hidden name"><code>AMR.Rmd</code></div>
@ -202,7 +202,7 @@
<p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 09 February 2021.</p> <p><strong>Note:</strong> values on this page will change with every website update since they are based on randomly created values and the page was written in <a href="https://rmarkdown.rstudio.com/">R Markdown</a>. However, the methodology remains unchanged. This page was generated on 02 February 2021.</p>
<div id="introduction" class="section level1"> <div id="introduction" class="section level1">
<h1 class="hasAnchor"> <h1 class="hasAnchor">
<a href="#introduction" class="anchor"></a>Introduction</h1> <a href="#introduction" class="anchor"></a>Introduction</h1>
@ -233,21 +233,21 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2021-02-09</td> <td align="center">2021-02-02</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2021-02-09</td> <td align="center">2021-02-02</td>
<td align="center">abcd</td> <td align="center">abcd</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">2021-02-09</td> <td align="center">2021-02-02</td>
<td align="center">efgh</td> <td align="center">efgh</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">R</td> <td align="center">R</td>
@ -352,71 +352,71 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">2014-07-31</td> <td align="center">2012-05-30</td>
<td align="center">F7</td> <td align="center">Q5</td>
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-10-04</td>
<td align="center">R8</td>
<td align="center">Hospital A</td>
<td align="center">Escherichia coli</td> <td align="center">Escherichia coli</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2015-02-19</td>
<td align="center">T6</td>
<td align="center">Hospital A</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2015-07-17</td>
<td align="center">R4</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2011-01-13</td>
<td align="center">Q4</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2013-04-17</td>
<td align="center">A6</td>
<td align="center">Hospital C</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">M</td> <td align="center">M</td>
</tr> </tr>
<tr class="even">
<td align="center">2017-11-01</td>
<td align="center">W10</td>
<td align="center">Hospital B</td>
<td align="center">Escherichia coli</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2013-06-17</td>
<td align="center">T1</td>
<td align="center">Hospital D</td>
<td align="center">Klebsiella pneumoniae</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2012-12-13</td>
<td align="center">Q2</td>
<td align="center">Hospital C</td>
<td align="center">Streptococcus pneumoniae</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="odd">
<td align="center">2010-01-01</td>
<td align="center">O10</td>
<td align="center">Hospital B</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
<tr class="even">
<td align="center">2010-07-24</td>
<td align="center">V5</td>
<td align="center">Hospital A</td>
<td align="center">Staphylococcus aureus</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
</tr>
</tbody> </tbody>
</table> </table>
<p>Now, lets start the cleaning and the analysis!</p> <p>Now, lets start the cleaning and the analysis!</p>
@ -449,16 +449,16 @@ Longest: 1</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">M</td> <td align="left">M</td>
<td align="right">10,335</td> <td align="right">10,232</td>
<td align="right">51.68%</td> <td align="right">51.16%</td>
<td align="right">10,335</td> <td align="right">10,232</td>
<td align="right">51.68%</td> <td align="right">51.16%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">F</td> <td align="left">F</td>
<td align="right">9,665</td> <td align="right">9,768</td>
<td align="right">48.33%</td> <td align="right">48.84%</td>
<td align="right">20,000</td> <td align="right">20,000</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
@ -503,7 +503,7 @@ Longest: 1</p>
<span class="co"># NOTE: Using column 'bacteria' as input for `col_mo`.</span> <span class="co"># NOTE: Using column 'bacteria' as input for `col_mo`.</span>
<span class="co"># NOTE: Using column 'date' as input for `col_date`.</span> <span class="co"># NOTE: Using column 'date' as input for `col_date`.</span>
<span class="co"># NOTE: Using column 'patient_id' as input for `col_patient_id`.</span></code></pre></div> <span class="co"># NOTE: Using column 'patient_id' as input for `col_patient_id`.</span></code></pre></div>
<p>So only 28.3% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p> <p>So only 28.4% is suitable for resistance analysis! We can now filter on it with the <code><a href="https://dplyr.tidyverse.org/reference/filter.html">filter()</a></code> function, also from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op">(</span><span class="va">first</span> <span class="op">==</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
@ -515,7 +515,7 @@ Longest: 1</p>
<div id="first-weighted-isolates" class="section level2"> <div id="first-weighted-isolates" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2> <a href="#first-weighted-isolates" class="anchor"></a>First <em>weighted</em> isolates</h2>
<p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all <em>E. coli</em> isolates of patient N1, sorted on date:</p> <p>We made a slight twist to the CLSI algorithm, to take into account the antimicrobial susceptibility profile. Have a look at all <em>E. coli</em> isolates of patient J3, sorted on date:</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
<th align="center">isolate</th> <th align="center">isolate</th>
@ -531,30 +531,30 @@ Longest: 1</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-03</td> <td align="center">2010-01-21</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">I</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-04-02</td> <td align="center">2010-03-02</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-06-23</td> <td align="center">2010-08-02</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -564,19 +564,19 @@ Longest: 1</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-06-25</td> <td align="center">2010-10-11</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-10-04</td> <td align="center">2010-10-15</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -586,52 +586,52 @@ Longest: 1</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-10-11</td> <td align="center">2010-10-23</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">7</td> <td align="center">7</td>
<td align="center">2010-10-29</td> <td align="center">2010-11-25</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2010-11-11</td> <td align="center">2010-12-31</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2010-12-06</td> <td align="center">2011-02-25</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">S</td>
<td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2010-12-13</td> <td align="center">2011-03-01</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">R</td> <td align="center">R</td>
@ -641,7 +641,7 @@ Longest: 1</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Only 1 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p> <p>Only 2 isolates are marked as first according to CLSI guideline. But when reviewing the antibiogram, it is obvious that some isolates are absolutely different strains and should be included too. This is why we weigh isolates, based on their antibiogram. The <code><a href="../reference/key_antibiotics.html">key_antibiotics()</a></code> function adds a vector with 18 key antibiotics: 6 broad spectrum ones, 6 small spectrum for Gram negatives and 6 small spectrum for Gram positives. These can be defined by the user.</p>
<p>If a column exists with a name like key(…)ab the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p> <p>If a column exists with a name like key(…)ab the <code><a href="../reference/first_isolate.html">first_isolate()</a></code> function will automatically use it and determine the first weighted isolates. Mind the NOTEs in below output:</p>
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span> <code class="sourceCode R"><span class="va">data</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
@ -665,11 +665,11 @@ Longest: 1</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">1</td> <td align="center">1</td>
<td align="center">2010-02-03</td> <td align="center">2010-01-21</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">I</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
@ -677,44 +677,44 @@ Longest: 1</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">2</td> <td align="center">2</td>
<td align="center">2010-04-02</td> <td align="center">2010-03-02</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">3</td> <td align="center">3</td>
<td align="center">2010-06-23</td> <td align="center">2010-08-02</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">FALSE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">4</td> <td align="center">4</td>
<td align="center">2010-06-25</td> <td align="center">2010-10-11</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">5</td> <td align="center">5</td>
<td align="center">2010-10-04</td> <td align="center">2010-10-15</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
@ -725,23 +725,23 @@ Longest: 1</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">6</td> <td align="center">6</td>
<td align="center">2010-10-11</td> <td align="center">2010-10-23</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">7</td> <td align="center">7</td>
<td align="center">2010-10-29</td> <td align="center">2010-11-25</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
@ -749,48 +749,48 @@ Longest: 1</p>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">8</td> <td align="center">8</td>
<td align="center">2010-11-11</td> <td align="center">2010-12-31</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">9</td> <td align="center">9</td>
<td align="center">2010-12-06</td> <td align="center">2011-02-25</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">S</td>
<td align="center">TRUE</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">10</td> <td align="center">10</td>
<td align="center">2010-12-13</td> <td align="center">2011-03-01</td>
<td align="center">N1</td> <td align="center">J3</td>
<td align="center">B_ESCHR_COLI</td> <td align="center">B_ESCHR_COLI</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">R</td> <td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">FALSE</td> <td align="center">FALSE</td>
<td align="center">TRUE</td> <td align="center">FALSE</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>Instead of 1, now 8 isolates are flagged. In total, 78.2% of all isolates are marked first weighted - 50.0% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p> <p>Instead of 2, now 9 isolates are flagged. In total, 78.5% of all isolates are marked first weighted - 50.2% more than when using the CLSI guideline. In real life, this novel algorithm will yield 5-10% more isolates than the classic CLSI guideline.</p>
<p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p> <p>As with <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code>, theres a shortcut for this new algorithm too:</p>
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span><span class="op">(</span><span class="op">)</span></code></pre></div> <span class="fu"><a href="../reference/first_isolate.html">filter_first_weighted_isolate</a></span><span class="op">(</span><span class="op">)</span></code></pre></div>
<p>So we end up with 15,648 isolates for analysis.</p> <p>So we end up with 15,707 isolates for analysis.</p>
<p>We can remove unneeded columns:</p> <p>We can remove unneeded columns:</p>
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data_1st</span> <span class="op">%&gt;%</span> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">&lt;-</span> <span class="va">data_1st</span> <span class="op">%&gt;%</span>
@ -800,7 +800,6 @@ Longest: 1</p>
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">data_1st</span><span class="op">)</span></code></pre></div> <code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">data_1st</span><span class="op">)</span></code></pre></div>
<table class="table"> <table class="table">
<colgroup> <colgroup>
<col width="2%">
<col width="8%"> <col width="8%">
<col width="8%"> <col width="8%">
<col width="8%"> <col width="8%">
@ -816,7 +815,6 @@ Longest: 1</p>
<col width="11%"> <col width="11%">
</colgroup> </colgroup>
<thead><tr class="header"> <thead><tr class="header">
<th align="left"></th>
<th align="center">date</th> <th align="center">date</th>
<th align="center">patient_id</th> <th align="center">patient_id</th>
<th align="center">hospital</th> <th align="center">hospital</th>
@ -833,9 +831,53 @@ Longest: 1</p>
</tr></thead> </tr></thead>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="left">4</td> <td align="center">2012-05-30</td>
<td align="center">2012-12-13</td> <td align="center">Q5</td>
<td align="center">Q2</td> <td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2012-10-04</td>
<td align="center">R8</td>
<td align="center">Hospital A</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">I</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="center">2015-02-19</td>
<td align="center">T6</td>
<td align="center">Hospital A</td>
<td align="center">B_KLBSL_PNMN</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-negative</td>
<td align="center">Klebsiella</td>
<td align="center">pneumoniae</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="center">2015-07-17</td>
<td align="center">R4</td>
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">B_STRPT_PNMN</td> <td align="center">B_STRPT_PNMN</td>
<td align="center">R</td> <td align="center">R</td>
@ -848,10 +890,9 @@ Longest: 1</p>
<td align="center">pneumoniae</td> <td align="center">pneumoniae</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="even"> <tr class="odd">
<td align="left">5</td> <td align="center">2011-01-13</td>
<td align="center">2010-01-01</td> <td align="center">Q4</td>
<td align="center">O10</td>
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">B_STPHY_AURS</td> <td align="center">B_STPHY_AURS</td>
<td align="center">R</td> <td align="center">R</td>
@ -864,65 +905,16 @@ Longest: 1</p>
<td align="center">aureus</td> <td align="center">aureus</td>
<td align="center">TRUE</td> <td align="center">TRUE</td>
</tr> </tr>
<tr class="odd">
<td align="left">6</td>
<td align="center">2010-07-24</td>
<td align="center">V5</td>
<td align="center">Hospital A</td>
<td align="center">B_STPHY_AURS</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">F</td>
<td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td>
<td align="center">aureus</td>
<td align="center">TRUE</td>
</tr>
<tr class="even"> <tr class="even">
<td align="left">7</td> <td align="center">2013-04-17</td>
<td align="center">2014-07-13</td> <td align="center">A6</td>
<td align="center">G3</td>
<td align="center">Hospital B</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="odd">
<td align="left">8</td>
<td align="center">2013-07-06</td>
<td align="center">K1</td>
<td align="center">Hospital D</td>
<td align="center">B_ESCHR_COLI</td>
<td align="center">S</td>
<td align="center">S</td>
<td align="center">R</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-negative</td>
<td align="center">Escherichia</td>
<td align="center">coli</td>
<td align="center">TRUE</td>
</tr>
<tr class="even">
<td align="left">9</td>
<td align="center">2011-07-06</td>
<td align="center">X4</td>
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">B_STPHY_AURS</td> <td align="center">B_STPHY_AURS</td>
<td align="center">R</td>
<td align="center">R</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">S</td> <td align="center">S</td>
<td align="center">F</td> <td align="center">S</td>
<td align="center">S</td>
<td align="center">M</td>
<td align="center">Gram-positive</td> <td align="center">Gram-positive</td>
<td align="center">Staphylococcus</td> <td align="center">Staphylococcus</td>
<td align="center">aureus</td> <td align="center">aureus</td>
@ -949,8 +941,8 @@ Longest: 1</p>
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span>, <span class="va">species</span><span class="op">)</span></code></pre></div> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span>, <span class="va">species</span><span class="op">)</span></code></pre></div>
<p><strong>Frequency table</strong></p> <p><strong>Frequency table</strong></p>
<p>Class: character<br> <p>Class: character<br>
Length: 15,648<br> Length: 15,707<br>
Available: 15,648 (100%, NA: 0 = 0%)<br> Available: 15,707 (100%, NA: 0 = 0%)<br>
Unique: 4</p> Unique: 4</p>
<p>Shortest: 16<br> <p>Shortest: 16<br>
Longest: 24</p> Longest: 24</p>
@ -967,33 +959,33 @@ Longest: 24</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">Escherichia coli</td> <td align="left">Escherichia coli</td>
<td align="right">7,846</td> <td align="right">7,921</td>
<td align="right">50.14%</td> <td align="right">50.43%</td>
<td align="right">7,846</td> <td align="right">7,921</td>
<td align="right">50.14%</td> <td align="right">50.43%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Staphylococcus aureus</td> <td align="left">Staphylococcus aureus</td>
<td align="right">3,871</td> <td align="right">3,853</td>
<td align="right">24.74%</td> <td align="right">24.53%</td>
<td align="right">11,717</td> <td align="right">11,774</td>
<td align="right">74.88%</td> <td align="right">74.96%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">3</td> <td align="left">3</td>
<td align="left">Streptococcus pneumoniae</td> <td align="left">Streptococcus pneumoniae</td>
<td align="right">2,331</td> <td align="right">2,349</td>
<td align="right">14.90%</td> <td align="right">14.96%</td>
<td align="right">14,048</td> <td align="right">14,123</td>
<td align="right">89.78%</td> <td align="right">89.92%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">4</td> <td align="left">4</td>
<td align="left">Klebsiella pneumoniae</td> <td align="left">Klebsiella pneumoniae</td>
<td align="right">1,600</td> <td align="right">1,584</td>
<td align="right">10.22%</td> <td align="right">10.08%</td>
<td align="right">15,648</td> <td align="right">15,707</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
</tbody> </tbody>
@ -1020,50 +1012,50 @@ Longest: 24</p>
<tr class="odd"> <tr class="odd">
<td align="center">E. coli</td> <td align="center">E. coli</td>
<td align="center">AMX</td> <td align="center">AMX</td>
<td align="center">3764</td> <td align="center">3775</td>
<td align="center">263</td> <td align="center">243</td>
<td align="center">3819</td> <td align="center">3903</td>
<td align="center">7846</td> <td align="center">7921</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">E. coli</td> <td align="center">E. coli</td>
<td align="center">AMC</td> <td align="center">AMC</td>
<td align="center">6286</td> <td align="center">6223</td>
<td align="center">255</td> <td align="center">298</td>
<td align="center">1305</td> <td align="center">1400</td>
<td align="center">7846</td> <td align="center">7921</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">E. coli</td> <td align="center">E. coli</td>
<td align="center">CIP</td> <td align="center">CIP</td>
<td align="center">5931</td> <td align="center">5995</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">1915</td> <td align="center">1926</td>
<td align="center">7846</td> <td align="center">7921</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">E. coli</td> <td align="center">E. coli</td>
<td align="center">GEN</td> <td align="center">GEN</td>
<td align="center">7043</td> <td align="center">7173</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">803</td> <td align="center">748</td>
<td align="center">7846</td> <td align="center">7921</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">K. pneumoniae</td> <td align="center">K. pneumoniae</td>
<td align="center">AMX</td> <td align="center">AMX</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">1600</td> <td align="center">1584</td>
<td align="center">1600</td> <td align="center">1584</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">K. pneumoniae</td> <td align="center">K. pneumoniae</td>
<td align="center">AMC</td> <td align="center">AMC</td>
<td align="center">1270</td> <td align="center">1230</td>
<td align="center">64</td> <td align="center">57</td>
<td align="center">266</td> <td align="center">297</td>
<td align="center">1600</td> <td align="center">1584</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1086,34 +1078,34 @@ Longest: 24</p>
<tr class="odd"> <tr class="odd">
<td align="center">E. coli</td> <td align="center">E. coli</td>
<td align="center">CIP</td> <td align="center">CIP</td>
<td align="center">5931</td> <td align="center">5995</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">1915</td> <td align="center">1926</td>
<td align="center">7846</td> <td align="center">7921</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">K. pneumoniae</td> <td align="center">K. pneumoniae</td>
<td align="center">CIP</td> <td align="center">CIP</td>
<td align="center">1214</td> <td align="center">1217</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">386</td> <td align="center">367</td>
<td align="center">1600</td> <td align="center">1584</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">S. aureus</td> <td align="center">S. aureus</td>
<td align="center">CIP</td> <td align="center">CIP</td>
<td align="center">2965</td> <td align="center">2930</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">906</td> <td align="center">923</td>
<td align="center">3871</td> <td align="center">3853</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">S. pneumoniae</td> <td align="center">S. pneumoniae</td>
<td align="center">CIP</td> <td align="center">CIP</td>
<td align="center">1801</td> <td align="center">1814</td>
<td align="center">0</td> <td align="center">0</td>
<td align="center">530</td> <td align="center">535</td>
<td align="center">2331</td> <td align="center">2349</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1126,7 +1118,7 @@ Longest: 24</p>
<p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p> <p>As per the EUCAST guideline of 2019, we calculate resistance as the proportion of R (<code><a href="../reference/proportion.html">proportion_R()</a></code>, equal to <code><a href="../reference/proportion.html">resistance()</a></code>) and susceptibility as the proportion of S and I (<code><a href="../reference/proportion.html">proportion_SI()</a></code>, equal to <code><a href="../reference/proportion.html">susceptibility()</a></code>). These functions can be used on their own:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/proportion.html">resistance</a></span><span class="op">(</span><span class="va">AMX</span><span class="op">)</span>
<span class="co"># [1] 0.5357873</span></code></pre></div> <span class="co"># [1] 0.5358121</span></code></pre></div>
<p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p> <p>Or can be used in conjuction with <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by()</a></code> and <code><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarise()</a></code>, both from the <code>dplyr</code> package:</p>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span> <code class="sourceCode R"><span class="va">data_1st</span> <span class="op">%&gt;%</span>
@ -1141,19 +1133,19 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.5376208</td> <td align="center">0.5293870</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.5299270</td> <td align="center">0.5388889</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.5439754</td> <td align="center">0.5364048</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.5373087</td> <td align="center">0.5397891</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1173,23 +1165,23 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital A</td> <td align="center">Hospital A</td>
<td align="center">0.5376208</td> <td align="center">0.5293870</td>
<td align="center">4758</td> <td align="center">4747</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital B</td> <td align="center">Hospital B</td>
<td align="center">0.5299270</td> <td align="center">0.5388889</td>
<td align="center">5480</td> <td align="center">5400</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Hospital C</td> <td align="center">Hospital C</td>
<td align="center">0.5439754</td> <td align="center">0.5364048</td>
<td align="center">2274</td> <td align="center">2431</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Hospital D</td> <td align="center">Hospital D</td>
<td align="center">0.5373087</td> <td align="center">0.5397891</td>
<td align="center">3136</td> <td align="center">3129</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1211,27 +1203,27 @@ Longest: 24</p>
<tbody> <tbody>
<tr class="odd"> <tr class="odd">
<td align="center">Escherichia</td> <td align="center">Escherichia</td>
<td align="center">0.8336732</td> <td align="center">0.8232546</td>
<td align="center">0.8976549</td> <td align="center">0.9055675</td>
<td align="center">0.9850879</td> <td align="center">0.9868703</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Klebsiella</td> <td align="center">Klebsiella</td>
<td align="center">0.8337500</td> <td align="center">0.8125000</td>
<td align="center">0.9050000</td> <td align="center">0.9084596</td>
<td align="center">0.9812500</td> <td align="center">0.9848485</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="center">Staphylococcus</td> <td align="center">Staphylococcus</td>
<td align="center">0.8235598</td> <td align="center">0.8219569</td>
<td align="center">0.9227590</td> <td align="center">0.9270698</td>
<td align="center">0.9842418</td> <td align="center">0.9890994</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="center">Streptococcus</td> <td align="center">Streptococcus</td>
<td align="center">0.5456885</td> <td align="center">0.5598127</td>
<td align="center">0.0000000</td> <td align="center">0.0000000</td>
<td align="center">0.5456885</td> <td align="center">0.5598127</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

Binary file not shown.

Before

(image error) Size: 38 KiB

After

(image error) Size: 38 KiB

Binary file not shown.

Before

(image error) Size: 26 KiB

After

(image error) Size: 26 KiB

Binary file not shown.

Before

(image error) Size: 68 KiB

After

(image error) Size: 68 KiB

Binary file not shown.

Before

(image error) Size: 45 KiB

After

(image error) Size: 45 KiB

@ -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.5.0.9018</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -285,7 +285,7 @@
<p>Class: factor &gt; ordered (numeric)<br> <p>Class: factor &gt; ordered (numeric)<br>
Length: 2,000<br> Length: 2,000<br>
Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively drug-resistant …<br> Levels: 4: Negative &lt; Multi-drug-resistant (MDR) &lt; Extensively drug-resistant …<br>
Available: 1,745 (87.25%, NA: 255 = 12.75%)<br> Available: 1,747 (87.35%, NA: 253 = 12.65%)<br>
Unique: 2</p> Unique: 2</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">
@ -301,16 +301,16 @@ Unique: 2</p>
<td align="left">1</td> <td align="left">1</td>
<td align="left">Negative</td> <td align="left">Negative</td>
<td align="right">1617</td> <td align="right">1617</td>
<td align="right">92.66%</td> <td align="right">92.56%</td>
<td align="right">1617</td> <td align="right">1617</td>
<td align="right">92.66%</td> <td align="right">92.56%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Multi-drug-resistant (MDR)</td> <td align="left">Multi-drug-resistant (MDR)</td>
<td align="right">128</td> <td align="right">130</td>
<td align="right">7.34%</td> <td align="right">7.44%</td>
<td align="right">1745</td> <td align="right">1747</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>
</tbody> </tbody>
@ -339,18 +339,18 @@ Unique: 2</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span> <code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">my_TB_data</span><span class="op">)</span>
<span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span> <span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span>
<span class="co"># 1 S R S S S I</span> <span class="co"># 1 I R R I I S</span>
<span class="co"># 2 S I R R R R</span> <span class="co"># 2 I S R I R R</span>
<span class="co"># 3 R S S I S I</span> <span class="co"># 3 S I S I S S</span>
<span class="co"># 4 I S S S I S</span> <span class="co"># 4 S R I S S S</span>
<span class="co"># 5 I I I S I R</span> <span class="co"># 5 I S I R S S</span>
<span class="co"># 6 S I S R S S</span> <span class="co"># 6 S R I R S S</span>
<span class="co"># kanamycin</span> <span class="co"># kanamycin</span>
<span class="co"># 1 R</span> <span class="co"># 1 S</span>
<span class="co"># 2 I</span> <span class="co"># 2 S</span>
<span class="co"># 3 R</span> <span class="co"># 3 R</span>
<span class="co"># 4 S</span> <span class="co"># 4 I</span>
<span class="co"># 5 S</span> <span class="co"># 5 R</span>
<span class="co"># 6 R</span></code></pre></div> <span class="co"># 6 R</span></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set. You can use:</p> <p>We can now add the interpretation of MDR-TB to our data set. You can use:</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
@ -382,40 +382,40 @@ Unique: 5</p>
<tr class="odd"> <tr class="odd">
<td align="left">1</td> <td align="left">1</td>
<td align="left">Mono-resistant</td> <td align="left">Mono-resistant</td>
<td align="right">3246</td> <td align="right">3211</td>
<td align="right">64.92%</td> <td align="right">64.22%</td>
<td align="right">3246</td> <td align="right">3211</td>
<td align="right">64.92%</td> <td align="right">64.22%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">2</td> <td align="left">2</td>
<td align="left">Negative</td> <td align="left">Negative</td>
<td align="right">976</td> <td align="right">990</td>
<td align="right">19.52%</td> <td align="right">19.80%</td>
<td align="right">4222</td> <td align="right">4201</td>
<td align="right">84.44%</td> <td align="right">84.02%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">3</td> <td align="left">3</td>
<td align="left">Multi-drug-resistant</td> <td align="left">Multi-drug-resistant</td>
<td align="right">467</td> <td align="right">435</td>
<td align="right">9.34%</td> <td align="right">8.70%</td>
<td align="right">4689</td> <td align="right">4636</td>
<td align="right">93.78%</td> <td align="right">92.72%</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td align="left">4</td> <td align="left">4</td>
<td align="left">Poly-resistant</td> <td align="left">Poly-resistant</td>
<td align="right">230</td> <td align="right">258</td>
<td align="right">4.60%</td> <td align="right">5.16%</td>
<td align="right">4919</td> <td align="right">4894</td>
<td align="right">98.38%</td> <td align="right">97.88%</td>
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td align="left">5</td> <td align="left">5</td>
<td align="left">Extensively drug-resistant</td> <td align="left">Extensively drug-resistant</td>
<td align="right">81</td> <td align="right">106</td>
<td align="right">1.62%</td> <td align="right">2.12%</td>
<td align="right">5000</td> <td align="right">5000</td>
<td align="right">100.00%</td> <td align="right">100.00%</td>
</tr> </tr>

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

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

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

@ -43,7 +43,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.5.0.9018</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
</span> </span>
</div> </div>
@ -197,7 +197,7 @@
<div class="page-header"><h1 class="hasAnchor"> <div class="page-header"><h1 class="hasAnchor">
<a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px"> <a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
</h1></div> </h1></div>
<p><em>Note: the rules of EUCAST Clinical Breakpoints v11.0 (2021) are implemented in <a href="./#latest-development-version">the latest beta version</a>, awaiting the next stable release (expected end of February)</em></p> <p><em>Note: the rules of EUCAST Clinical Breakpoints v11.0 (2021) will be added in the next release, to be expected in February/March 2021.</em></p>
<blockquote> <blockquote>
<p><span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> <strong>PLEASE TAKE PART IN OUR SURVEY!</strong><br> <p><span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> <strong>PLEASE TAKE PART IN OUR SURVEY!</strong><br>
Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. <strong>If you have a minute, please <a href="./survey.html">anonymously fill in this short questionnaire</a></strong>. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance! <br><a class="btn btn-info btn-amr" href="./survey.html">Take me to the 5-min survey!</a></p> Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. <strong>If you have a minute, please <a href="./survey.html">anonymously fill in this short questionnaire</a></strong>. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance! <br><a class="btn btn-info btn-amr" href="./survey.html">Take me to the 5-min survey!</a></p>
@ -230,9 +230,9 @@ Since you are one of our users, we would like to know how you use the package an
<span class="co">#&gt; NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()</span> <span class="co">#&gt; NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()</span>
<span class="co">#&gt; NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and</span> <span class="co">#&gt; NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and</span>
<span class="co">#&gt; 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020).</span> <span class="co">#&gt; 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020).</span>
<span class="co">#&gt; Selecting aminoglycosides: columns 'AMK' (amikacin), 'GEN' (gentamicin), </span> <span class="co">#&gt; Selecting aminoglycosides: 'AMK' (amikacin), 'GEN' (gentamicin), </span>
<span class="co">#&gt; 'KAN' (kanamycin) and 'TOB' (tobramycin)</span> <span class="co">#&gt; 'KAN' (kanamycin), 'TOB' (tobramycin)</span>
<span class="co">#&gt; Selecting carbapenems: columns 'IPM' (imipenem) and 'MEM' (meropenem)</span></code></pre></div> <span class="co">#&gt; Selecting carbapenems: 'IPM' (imipenem), 'MEM' (meropenem)</span></code></pre></div>
<p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p> <p>With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (<code><a href="reference/mo_property.html">mo_is_gram_negative()</a></code> and <code><a href="reference/mo_property.html">mo_is_intrinsic_resistant()</a></code>) and a column selection on two antibiotic groups (<code><a href="reference/antibiotic_class_selectors.html">aminoglycosides()</a></code> and <code><a href="reference/antibiotic_class_selectors.html">carbapenems()</a></code>), the reference data about <a href="./reference/microorganisms.html">all microorganisms</a> and <a href="./reference/antibiotics.html">all antibiotics</a> in the <code>AMR</code> package make sure you get what you meant:</p>
<table class="table"> <table class="table">
<thead><tr class="header"> <thead><tr class="header">

@ -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.5.0.9018</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
</span> </span>
</div> </div>
@ -236,28 +236,22 @@
<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-1509018" class="section level1"> <div id="amr-1509015" class="section level1">
<h1 class="page-header" data-toc-text="1.5.0.9018"> <h1 class="page-header" data-toc-text="1.5.0.9015">
<a href="#amr-1509018" class="anchor"></a>AMR 1.5.0.9018<small> Unreleased </small> <a href="#amr-1509015" class="anchor"></a>AMR 1.5.0.9015<small> Unreleased </small>
</h1> </h1>
<div id="last-updated-9-february-2021" class="section level2"> <div id="last-updated-4-february-2021" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-9-february-2021" class="anchor"></a><small>Last updated: 9 February 2021</small> <a href="#last-updated-4-february-2021" class="anchor"></a><small>Last updated: 4 February 2021</small>
</h2> </h2>
<div id="new" class="section level3"> <div id="breaking" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3> <a href="#breaking" class="anchor"></a>Breaking</h3>
<ul> <ul>
<li> <li>
<p>Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function and in <code><a href="../reference/as.rsi.html">as.rsi()</a></code> to interpret MIC and disk diffusion values. This is now the default guideline in this package.</p> <p>Functions that are applied to a data set containing antibiotic columns gained the argument <code>only_rsi_columns</code>, which defaults to <code>TRUE</code> if any of the columns are of class <code>&lt;rsi&gt;</code> (i.e., transformed with <code><a href="../reference/as.rsi.html">as.rsi()</a></code>). This increases reliability of automatic determination of antibiotic columns (so only columns that are defined to be <code>&lt;rsi&gt;</code> will be affected).</p>
<ul> <p>This change might invalidate existing code. But since the new argument always returns <code>FALSE</code> when no <code>&lt;rsi&gt;</code> column can be found in the data, this chance is low.</p>
<li>Added function <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> to get a <code>data.frame</code> with advised dosages of a certain bug-drug combination, which is based on the new <code>dosage</code> data set</li> <p>Affected functions are:</p>
<li>Added data set <code>dosage</code> to fuel the new <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> function and to make this data available in a structured way</li>
<li>Existing data set <code>example_isolates</code> now reflects the latest EUCAST rules</li>
</ul>
</li>
<li>
<p>Added argument <code>only_rsi_columns</code> for some functions, which defaults to <code>FALSE</code>, to indicate if the functions must only be applied to columns that are of class <code>&lt;rsi&gt;</code> (i.e., transformed with <code><a href="../reference/as.rsi.html">as.rsi()</a></code>). This increases speed since automatic determination of antibiotic columns is not needed anymore. Affected functions are:</p>
<ul> <ul>
<li>All antibiotic selector functions (<code><a href="../reference/antibiotic_class_selectors.html">ab_class()</a></code> and its wrappers, such as <code>aminoglocysides()</code>, <code><a href="../reference/antibiotic_class_selectors.html">carbapenems()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">penicillins()</a></code>)</li> <li>All antibiotic selector functions (<code><a href="../reference/antibiotic_class_selectors.html">ab_class()</a></code> and its wrappers, such as <code>aminoglocysides()</code>, <code><a href="../reference/antibiotic_class_selectors.html">carbapenems()</a></code>, <code><a href="../reference/antibiotic_class_selectors.html">penicillins()</a></code>)</li>
<li>All antibiotic filter functions (<code><a href="../reference/filter_ab_class.html">filter_ab_class()</a></code> and its wrappers, such as <code>filter_aminoglocysides()</code>, <code><a href="../reference/filter_ab_class.html">filter_carbapenems()</a></code>, <code><a href="../reference/filter_ab_class.html">filter_penicillins()</a></code>)</li> <li>All antibiotic filter functions (<code><a href="../reference/filter_ab_class.html">filter_ab_class()</a></code> and its wrappers, such as <code>filter_aminoglocysides()</code>, <code><a href="../reference/filter_ab_class.html">filter_carbapenems()</a></code>, <code><a href="../reference/filter_ab_class.html">filter_penicillins()</a></code>)</li>
@ -266,18 +260,22 @@
<code><a href="../reference/mdro.html">mdro()</a></code> (including wrappers such as <code><a href="../reference/mdro.html">brmo()</a></code>, <code>mrgn</code> and <code><a href="../reference/mdro.html">eucast_exceptional_phenotypes()</a></code>)</li> <code><a href="../reference/mdro.html">mdro()</a></code> (including wrappers such as <code><a href="../reference/mdro.html">brmo()</a></code>, <code>mrgn</code> and <code><a href="../reference/mdro.html">eucast_exceptional_phenotypes()</a></code>)</li>
<li><code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code></li> <li><code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code></li>
</ul> </ul>
</li> <p>You can quickly transform all your eligible columns using either:</p>
<li>
<p>Functions <code><a href="../reference/antibiotic_class_selectors.html">oxazolidinones()</a></code> (an antibiotic selector function) and <code><a href="../reference/filter_ab_class.html">filter_oxazolidinones()</a></code> (an antibiotic filter function) to select/filter on e.g. linezolid and tedizolid</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"> <code class="sourceCode R">
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span> <span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op">)</span>
<span class="va">x</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op">(</span><span class="va">date</span>, <span class="va">hospital_id</span>, <span class="fu"><a href="../reference/antibiotic_class_selectors.html">oxazolidinones</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="va">your_date</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_if</a></span><span class="op">(</span><span class="va">is.rsi.eligible</span>, <span class="va">as.rsi</span><span class="op">)</span> <span class="co"># old dplyr</span>
<span class="co">#&gt; Selecting oxazolidinones: column 'LNZ' (linezolid)</span> <span class="va">your_date</span> <span class="op">%&gt;%</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op">(</span><span class="fu"><a href="https://dplyr.tidyverse.org/reference/across.html">across</a></span><span class="op">(</span><span class="op">(</span><span class="va">is.rsi.eligible</span><span class="op">)</span>, <span class="va">as.rsi</span><span class="op">)</span><span class="op">)</span> <span class="co"># new dplyr</span></code></pre></div>
<span class="va">x</span> <span class="op">&lt;-</span> <span class="va">example_isolates</span> <span class="op">%&gt;%</span> <span class="fu"><a href="../reference/filter_ab_class.html">filter_oxazolidinones</a></span><span class="op">(</span><span class="op">)</span>
<span class="co">#&gt; Filtering on oxazolidinones: value in column `LNZ` (linezolid) is either "R", "S" or "I"</span></code></pre></div>
</li> </li>
</ul>
</div>
<div id="new" class="section level3">
<h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3>
<ul>
<li><p>Support for EUCAST Clinical Breakpoints v11.0 (2021), effective in the <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> function and in <code><a href="../reference/as.rsi.html">as.rsi()</a></code> to interpret MIC and disk diffusion values. This is now the default guideline in this package.</p></li>
<li><p>Data set <code>dosage</code> to fuel the new <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> function and to make this data available in a structured way</p></li>
<li><p>Function <code><a href="../reference/eucast_rules.html">eucast_dosage()</a></code> to get a <code>data.frame</code> with advised dosages of a certain bug-drug combination, which is based on the new <code>dosage</code> data set</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>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>Function <code><a href="../reference/isolate_identifier.html">isolate_identifier()</a></code>, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.</p></li> <li><p>Function <code><a href="../reference/isolate_identifier.html">isolate_identifier()</a></code>, which will paste a microorganism code with all antimicrobial results of a data set into one string for each row. This is useful to compare isolates, e.g. between institutions or regions, when there is no genotyping available.</p></li>
<li> <li>
@ -322,9 +320,10 @@
<li>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> now support less than a day as value for argument <code>episode_days</code> (e.g., to include one patient/test per hour)</li> <li>Functions <code><a href="../reference/get_episode.html">get_episode()</a></code> and <code><a href="../reference/get_episode.html">is_new_episode()</a></code> now support less than a day as value for argument <code>episode_days</code> (e.g., to include one patient/test per hour)</li>
<li>Argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now also applies to value “I” (not only “S”)</li> <li>Argument <code>ampc_cephalosporin_resistance</code> in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> now also applies to value “I” (not only “S”)</li>
<li>Updated colours of values R, S and I in tibble printing</li> <li>Updated colours of values R, S and I in tibble printing</li>
<li>Functions <code><a href="https://rdrr.io/r/base/print.html">print()</a></code> and <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> on a Principal Components Analysis object (<code><a href="../reference/pca.html">pca()</a></code>) now print additional group info if the original data was grouped using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">dplyr::group_by()</a></code> <li>Functions <code><a href="https://docs.ropensci.org/skimr/reference/print.html">print()</a></code> and <code><a href="https://rdrr.io/r/base/summary.html">summary()</a></code> on a Principal Components Analysis object (<code><a href="../reference/pca.html">pca()</a></code>) now print additional group info if the original data was grouped using <code><a href="https://dplyr.tidyverse.org/reference/group_by.html">dplyr::group_by()</a></code>
</li>
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
</li> </li>
<li>Improved speed and reliability of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>. As this also internally improves the reliability of <code><a href="../reference/first_isolate.html">first_isolate()</a></code> and <code><a href="../reference/mdro.html">mdro()</a></code>, this might have a slight impact on the results of those functions.</li>
</ul> </ul>
</div> </div>
<div id="other" class="section level3"> <div id="other" class="section level3">
@ -642,16 +641,16 @@
<h1 class="page-header" data-toc-text="1.2.0"> <h1 class="page-header" data-toc-text="1.2.0">
<a href="#amr-120" class="anchor"></a>AMR 1.2.0<small> 2020-05-28 </small> <a href="#amr-120" class="anchor"></a>AMR 1.2.0<small> 2020-05-28 </small>
</h1> </h1>
<div id="breaking" class="section level3"> <div id="breaking-1" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#breaking" class="anchor"></a>Breaking</h3> <a href="#breaking-1" class="anchor"></a>Breaking</h3>
<ul> <ul>
<li> <li>
<p>Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.</p> <p>Removed code dependency on all other R packages, making this package fully independent of the development process of others. This is a major code change, but will probably not be noticeable by most users.</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>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><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>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><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>&lt;ord&gt;</code>, not <code>&lt;rsi&gt;</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>&lt;ord&gt;</code>, not <code>&lt;rsi&gt;</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>
@ -852,9 +851,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<h1 class="page-header" data-toc-text="0.9.0"> <h1 class="page-header" data-toc-text="0.9.0">
<a href="#amr-090" class="anchor"></a>AMR 0.9.0<small> 2019-11-29 </small> <a href="#amr-090" class="anchor"></a>AMR 0.9.0<small> 2019-11-29 </small>
</h1> </h1>
<div id="breaking-1" class="section level3"> <div id="breaking-2" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#breaking-1" class="anchor"></a>Breaking</h3> <a href="#breaking-2" class="anchor"></a>Breaking</h3>
<ul> <ul>
<li>Adopted Adeolu <em>et al.</em> (2016), <a href="https:/pubmed.ncbi.nlm.nih.gov/27620848/">PMID 27620848</a> for the <code>microorganisms</code> data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like <em>Morganellaceae</em> and <em>Yersiniaceae</em>). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with <code><a href="../reference/mdro.html">mdro()</a></code> will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family. <li>Adopted Adeolu <em>et al.</em> (2016), <a href="https:/pubmed.ncbi.nlm.nih.gov/27620848/">PMID 27620848</a> for the <code>microorganisms</code> data set, which means that the new order Enterobacterales now consists of a part of the existing family Enterobacteriaceae, but that this family has been split into other families as well (like <em>Morganellaceae</em> and <em>Yersiniaceae</em>). Although published in 2016, this information is not yet in the Catalogue of Life version of 2019. All MDRO determinations with <code><a href="../reference/mdro.html">mdro()</a></code> will now use the Enterobacterales order for all guidelines before 2016 that were dependent on the Enterobacteriaceae family.
<ul> <ul>
@ -960,9 +959,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<h1 class="page-header" data-toc-text="0.8.0"> <h1 class="page-header" data-toc-text="0.8.0">
<a href="#amr-080" class="anchor"></a>AMR 0.8.0<small> 2019-10-15 </small> <a href="#amr-080" class="anchor"></a>AMR 0.8.0<small> 2019-10-15 </small>
</h1> </h1>
<div id="breaking-2" class="section level3"> <div id="breaking-3" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">
<a href="#breaking-2" class="anchor"></a>Breaking</h3> <a href="#breaking-3" class="anchor"></a>Breaking</h3>
<ul> <ul>
<li> <li>
<p>Determination of first isolates now <strong>excludes</strong> all unknown microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new argument <code>include_unknown</code>:</p> <p>Determination of first isolates now <strong>excludes</strong> all unknown microorganisms at default, i.e. microbial code <code>"UNKNOWN"</code>. They can be included with the new argument <code>include_unknown</code>:</p>
@ -988,7 +987,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<span class="co">#&gt; invalid microorganism code, NA generated</span></code></pre></div> <span class="co">#&gt; 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><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>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>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>
@ -1257,7 +1256,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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>): <li>Frequency tables (<code>freq()</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>
@ -1267,12 +1266,12 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"> <code class="sourceCode R">
<span class="va">septic_patients</span> <span class="op">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</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">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="op">%&gt;%</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>
@ -1282,7 +1281,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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> for when all values are <code>NA</code> <li>Fix for <code>freq()</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>
@ -1523,7 +1522,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li> </li>
</ul> </ul>
</li> </li>
<li>Frequency tables (<code><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code> function): <li>Frequency tables (<code>freq()</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>
@ -1533,15 +1532,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">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">genus</span><span class="op">)</span> <span class="fu">freq</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">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="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">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="co"># Even supports grouping variables:</span> <span class="co"># Even supports grouping variables:</span>
<span class="va">septic_patients</span> <span class="op">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</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></code></pre></div> <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>
</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>
@ -1624,7 +1623,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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq()</a></code>:</p> <p>Frequency tables - <code>freq()</code>:</p>
<ul> <ul>
<li> <li>
<p>Support for grouping variables, test with:</p> <p>Support for grouping variables, test with:</p>
@ -1632,14 +1631,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">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</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">%&gt;%</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">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div> <span class="fu">freq</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="cb39"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
<code class="sourceCode R"> <code class="sourceCode R">
<span class="va">septic_patients</span> <span class="op">%&gt;%</span> <span class="va">septic_patients</span> <span class="op">%&gt;%</span>
<span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%&gt;%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">hospital_id</span><span class="op">)</span> <span class="op">%&gt;%</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>
@ -1657,7 +1656,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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">top_freq()</a></code></p></li> <li><p>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</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>
@ -1825,13 +1824,13 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb46"><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"><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> <span class="fu">freq</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="cb47"><pre class="downlit sourceCode r"> <div class="sourceCode" id="cb47"><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">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">age</span><span class="op">)</span> <span class="va">my_list</span> <span class="op">%&gt;%</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">%&gt;%</span> <span class="fu"><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq</a></span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div> <span class="va">my_list</span> <span class="op">%&gt;%</span> <span class="fu">freq</span><span class="op">(</span><span class="va">gender</span><span class="op">)</span></code></pre></div>
</li> </li>
</ul> </ul>
</div> </div>
@ -1905,13 +1904,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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(table(x, y))</a></code> <li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</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><a href="https://rdrr.io/pkg/cleaner/man/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %&gt;% freq(mycolumn)</code> <li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %&gt;% 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-02-09T11:26Z last_built: 2021-02-04T15:47Z
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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>

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

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

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -317,7 +317,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>All output <a href='translate.html'>will be translated</a> where possible.</p> <p>All output will be <a href='translate.html'>translate</a>d where possible.</p>
<p>The function <code>ab_url()</code> will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.</p> <p>The function <code>ab_url()</code> will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.</p>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2> <h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>

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

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

@ -83,7 +83,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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9013</span>
</span> </span>
</div> </div>
@ -244,35 +244,33 @@
</strong></p> </strong></p>
</div> </div>
<pre class="usage"><span class='fu'>ab_class</span><span class='op'>(</span><span class='va'>ab_class</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <pre class="usage"><span class='fu'>ab_class</span><span class='op'>(</span><span class='va'>ab_class</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>aminoglycosides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>aminoglycosides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>carbapenems</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>carbapenems</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins_1st</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins_1st</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins_2nd</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins_2nd</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins_3rd</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins_3rd</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins_4th</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins_4th</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>cephalosporins_5th</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>cephalosporins_5th</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>fluoroquinolones</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>fluoroquinolones</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>glycopeptides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>glycopeptides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>macrolides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>macrolides</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>oxazolidinones</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>penicillins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span>
<span class='fu'>penicillins</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> <span class='fu'>tetracyclines</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>NULL</span><span class='op'>)</span></pre>
<span class='fu'>tetracyclines</span><span class='op'>(</span>only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments"> <table class="ref-arguments">
@ -283,7 +281,7 @@
</tr> </tr>
<tr> <tr>
<th>only_rsi_columns</th> <th>only_rsi_columns</th>
<td><p>a logical to indicate whether only columns of class <a href='[rsi]'><code>&lt;rsi&gt;</code></a> must be selected (defaults to <code>FALSE</code>)</p></td> <td><p>a logical to indicate whether only columns of class <a href='[rsi]'><code>&lt;rsi&gt;</code></a> must be selected. If set to <code>NULL</code> (default), it will be <code>TRUE</code> if any column of the data was <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand, and <code>FALSE</code> otherwise.</p></td>
</tr> </tr>
</table> </table>

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

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

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

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

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

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

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

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

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

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

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

@ -83,7 +83,7 @@ count_resistant() should be used to count resistant isolates, count_susceptible(
</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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>

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

@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -253,7 +253,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
version_breakpoints <span class='op'>=</span> <span class='fl'>11</span>, version_breakpoints <span class='op'>=</span> <span class='fl'>11</span>,
version_expertrules <span class='op'>=</span> <span class='fl'>3.2</span>, version_expertrules <span class='op'>=</span> <span class='fl'>3.2</span>,
ampc_cephalosporin_resistance <span class='op'>=</span> <span class='cn'>NA</span>, ampc_cephalosporin_resistance <span class='op'>=</span> <span class='cn'>NA</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>,
<span class='va'>...</span> <span class='va'>...</span>
<span class='op'>)</span> <span class='op'>)</span>
@ -296,7 +296,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied
</tr> </tr>
<tr> <tr>
<th>only_rsi_columns</th> <th>only_rsi_columns</th>
<td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand (defaults to <code>FALSE</code>)</p></td> <td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand. Defaults to <code>TRUE</code> if any column of <code>x</code> is of class <code>&lt;rsi&gt;</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9013</span>
</span> </span>
</div> </div>
@ -247,121 +247,35 @@
<span class='va'>ab_class</span>, <span class='va'>ab_class</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>,
<span class='va'>...</span> <span class='va'>...</span>
<span class='op'>)</span> <span class='op'>)</span>
<span class='fu'>filter_aminoglycosides</span><span class='op'>(</span> <span class='fu'>filter_aminoglycosides</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_carbapenems</span><span class='op'>(</span> <span class='fu'>filter_carbapenems</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_1st_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_1st_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_2nd_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_2nd_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_3rd_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_3rd_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_4th_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_4th_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_5th_cephalosporins</span><span class='op'>(</span> <span class='fu'>filter_5th_cephalosporins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_fluoroquinolones</span><span class='op'>(</span> <span class='fu'>filter_fluoroquinolones</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_glycopeptides</span><span class='op'>(</span> <span class='fu'>filter_glycopeptides</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_macrolides</span><span class='op'>(</span> <span class='fu'>filter_macrolides</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_oxazolidinones</span><span class='op'>(</span> <span class='fu'>filter_penicillins</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_penicillins</span><span class='op'>(</span> <span class='fu'>filter_tetracyclines</span><span class='op'>(</span><span class='va'>x</span>, result <span class='op'>=</span> <span class='cn'>NULL</span>, scope <span class='op'>=</span> <span class='st'>"any"</span>, <span class='va'>...</span><span class='op'>)</span></pre>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span>
<span class='fu'>filter_tetracyclines</span><span class='op'>(</span>
<span class='va'>x</span>,
result <span class='op'>=</span> <span class='cn'>NULL</span>,
scope <span class='op'>=</span> <span class='st'>"any"</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>,
<span class='va'>...</span>
<span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments"> <table class="ref-arguments">
@ -384,7 +298,7 @@
</tr> </tr>
<tr> <tr>
<th>only_rsi_columns</th> <th>only_rsi_columns</th>
<td><p>a logical to indicate whether only columns must be included that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand (defaults to <code>FALSE</code>)</p></td> <td><p>a logical to indicate whether only columns must be included that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand. Defaults to <code>TRUE</code> if any column of <code>x</code> is of class <code>&lt;rsi&gt;</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
</span> </span>
</div> </div>
@ -243,7 +243,7 @@
</div> </div>
<pre class="usage"><span class='fu'>first_isolate</span><span class='op'>(</span> <pre class="usage"><span class='fu'>first_isolate</span><span class='op'>(</span>
x <span class='op'>=</span> <span class='cn'>NULL</span>, <span class='va'>x</span>,
col_date <span class='op'>=</span> <span class='cn'>NULL</span>, col_date <span class='op'>=</span> <span class='cn'>NULL</span>,
col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>, col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>,
col_mo <span class='op'>=</span> <span class='cn'>NULL</span>, col_mo <span class='op'>=</span> <span class='cn'>NULL</span>,
@ -264,7 +264,7 @@
<span class='op'>)</span> <span class='op'>)</span>
<span class='fu'>filter_first_isolate</span><span class='op'>(</span> <span class='fu'>filter_first_isolate</span><span class='op'>(</span>
x <span class='op'>=</span> <span class='cn'>NULL</span>, <span class='va'>x</span>,
col_date <span class='op'>=</span> <span class='cn'>NULL</span>, col_date <span class='op'>=</span> <span class='cn'>NULL</span>,
col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>, col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>,
col_mo <span class='op'>=</span> <span class='cn'>NULL</span>, col_mo <span class='op'>=</span> <span class='cn'>NULL</span>,
@ -272,7 +272,7 @@
<span class='op'>)</span> <span class='op'>)</span>
<span class='fu'>filter_first_weighted_isolate</span><span class='op'>(</span> <span class='fu'>filter_first_weighted_isolate</span><span class='op'>(</span>
x <span class='op'>=</span> <span class='cn'>NULL</span>, <span class='va'>x</span>,
col_date <span class='op'>=</span> <span class='cn'>NULL</span>, col_date <span class='op'>=</span> <span class='cn'>NULL</span>,
col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>, col_patient_id <span class='op'>=</span> <span class='cn'>NULL</span>,
col_mo <span class='op'>=</span> <span class='cn'>NULL</span>, col_mo <span class='op'>=</span> <span class='cn'>NULL</span>,
@ -285,7 +285,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup> <colgroup><col class="name" /><col class="desc" /></colgroup>
<tr> <tr>
<th>x</th> <th>x</th>
<td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates. Can be left blank for automatic determination, see <em>Examples</em>.</p></td> <td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates. Can be left blank for automatic determination.</p></td>
</tr> </tr>
<tr> <tr>
<th>col_date</th> <th>col_date</th>
@ -399,7 +399,7 @@
<li><p>Using <code>type = "keyantibiotics"</code> and argument <code>ignore_I</code></p> <li><p>Using <code>type = "keyantibiotics"</code> and argument <code>ignore_I</code></p>
<p>Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the <code><a href='key_antibiotics.html'>key_antibiotics()</a></code> function.</p></li> <p>Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the <code><a href='key_antibiotics.html'>key_antibiotics()</a></code> function.</p></li>
<li><p>Using <code>type = "points"</code> and argument <code>points_threshold</code></p> <li><p>Using <code>type = "points"</code> and argument <code>points_threshold</code></p>
<p>A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds <code>points_threshold</code>, which defaults to <code>2</code>, an isolate will be (re)selected as a first weighted isolate.</p></li> <p>A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds <code>points_threshold</code>, which default to <code>2</code>, an isolate will be (re)selected as a first weighted isolate.</p></li>
</ol> </ol>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2> <h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>
@ -422,12 +422,10 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span> <pre class="examples"><span class='co'># `example_isolates` is a data set available in the AMR package.</span>
<span class='co'># See ?example_isolates.</span> <span class='co'># See ?example_isolates.</span>
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='va'>example_isolates</span><span class='op'>)</span>, <span class='op'>]</span> <span class='co'># basic filtering on first isolates</span>
<span class='co'># \donttest{</span>
<span class='co'># faster way, only works in R 3.2 and later:</span>
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span>, <span class='op'>]</span> <span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span>, <span class='op'>]</span>
<span class='co'># \donttest{</span>
<span class='co'># get all first Gram-negatives</span> <span class='co'># get all first Gram-negatives</span>
<span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'><a href='https://rdrr.io/r/base/which.html'>which</a></span><span class='op'>(</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>&amp;</span> <span class='fu'><a href='mo_property.html'>mo_is_gram_negative</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>, <span class='op'>]</span> <span class='va'>example_isolates</span><span class='op'>[</span><span class='fu'><a href='https://rdrr.io/r/base/which.html'>which</a></span><span class='op'>(</span><span class='fu'>first_isolate</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>&amp;</span> <span class='fu'><a href='mo_property.html'>mo_is_gram_negative</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span>, <span class='op'>]</span>

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

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -246,7 +246,7 @@
x <span class='op'>=</span> <span class='cn'>NULL</span>, x <span class='op'>=</span> <span class='cn'>NULL</span>,
search_string <span class='op'>=</span> <span class='cn'>NULL</span>, search_string <span class='op'>=</span> <span class='cn'>NULL</span>,
verbose <span class='op'>=</span> <span class='cn'>FALSE</span>, verbose <span class='op'>=</span> <span class='cn'>FALSE</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span> only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>
<span class='op'>)</span></pre> <span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
@ -266,7 +266,7 @@
</tr> </tr>
<tr> <tr>
<th>only_rsi_columns</th> <th>only_rsi_columns</th>
<td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand (defaults to <code>FALSE</code>)</p></td> <td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand. Defaults to <code>TRUE</code> if any column of <code>x</code> is of class <code>&lt;rsi&gt;</code>.</p></td>
</tr> </tr>
</table> </table>

@ -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.5.0.9018</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
</span> </span>
</div> </div>
@ -526,13 +526,13 @@
</tr><tr> </tr><tr>
<td> <td>
<p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">oxazolidinones()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> </p> <p><code><a href="antibiotic_class_selectors.html">ab_class()</a></code> <code><a href="antibiotic_class_selectors.html">aminoglycosides()</a></code> <code><a href="antibiotic_class_selectors.html">carbapenems()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_1st()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_2nd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_3rd()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_4th()</a></code> <code><a href="antibiotic_class_selectors.html">cephalosporins_5th()</a></code> <code><a href="antibiotic_class_selectors.html">fluoroquinolones()</a></code> <code><a href="antibiotic_class_selectors.html">glycopeptides()</a></code> <code><a href="antibiotic_class_selectors.html">macrolides()</a></code> <code><a href="antibiotic_class_selectors.html">penicillins()</a></code> <code><a href="antibiotic_class_selectors.html">tetracyclines()</a></code> </p>
</td> </td>
<td><p>Antibiotic Class Selectors</p></td> <td><p>Antibiotic Class Selectors</p></td>
</tr><tr> </tr><tr>
<td> <td>
<p><code><a href="filter_ab_class.html">filter_ab_class()</a></code> <code><a href="filter_ab_class.html">filter_aminoglycosides()</a></code> <code><a href="filter_ab_class.html">filter_carbapenems()</a></code> <code><a href="filter_ab_class.html">filter_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_1st_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_2nd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_3rd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_4th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_5th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_fluoroquinolones()</a></code> <code><a href="filter_ab_class.html">filter_glycopeptides()</a></code> <code><a href="filter_ab_class.html">filter_macrolides()</a></code> <code><a href="filter_ab_class.html">filter_oxazolidinones()</a></code> <code><a href="filter_ab_class.html">filter_penicillins()</a></code> <code><a href="filter_ab_class.html">filter_tetracyclines()</a></code> </p> <p><code><a href="filter_ab_class.html">filter_ab_class()</a></code> <code><a href="filter_ab_class.html">filter_aminoglycosides()</a></code> <code><a href="filter_ab_class.html">filter_carbapenems()</a></code> <code><a href="filter_ab_class.html">filter_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_1st_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_2nd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_3rd_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_4th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_5th_cephalosporins()</a></code> <code><a href="filter_ab_class.html">filter_fluoroquinolones()</a></code> <code><a href="filter_ab_class.html">filter_glycopeptides()</a></code> <code><a href="filter_ab_class.html">filter_macrolides()</a></code> <code><a href="filter_ab_class.html">filter_penicillins()</a></code> <code><a href="filter_ab_class.html">filter_tetracyclines()</a></code> </p>
</td> </td>
<td><p>Filter Isolates on Result in Antimicrobial Class</p></td> <td><p>Filter Isolates on Result in Antimicrobial Class</p></td>
</tr><tr> </tr><tr>

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

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -243,7 +243,7 @@
</div> </div>
<pre class="usage"><span class='fu'>key_antibiotics</span><span class='op'>(</span> <pre class="usage"><span class='fu'>key_antibiotics</span><span class='op'>(</span>
x <span class='op'>=</span> <span class='cn'>NULL</span>, <span class='va'>x</span>,
col_mo <span class='op'>=</span> <span class='cn'>NULL</span>, col_mo <span class='op'>=</span> <span class='cn'>NULL</span>,
universal_1 <span class='op'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='st'>"amoxicillin"</span><span class='op'>)</span>, universal_1 <span class='op'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='st'>"amoxicillin"</span><span class='op'>)</span>,
universal_2 <span class='op'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='st'>"amoxicillin/clavulanic acid"</span><span class='op'>)</span>, universal_2 <span class='op'>=</span> <span class='fu'><a href='guess_ab_col.html'>guess_ab_col</a></span><span class='op'>(</span><span class='va'>x</span>, <span class='st'>"amoxicillin/clavulanic acid"</span><span class='op'>)</span>,
@ -380,7 +380,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
<li><p>Using <code>type = "keyantibiotics"</code> and argument <code>ignore_I</code></p> <li><p>Using <code>type = "keyantibiotics"</code> and argument <code>ignore_I</code></p>
<p>Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the <code>key_antibiotics()</code> function.</p></li> <p>Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With <code>ignore_I = FALSE</code>, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the <code>key_antibiotics()</code> function.</p></li>
<li><p>Using <code>type = "points"</code> and argument <code>points_threshold</code></p> <li><p>Using <code>type = "points"</code> and argument <code>points_threshold</code></p>
<p>A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds <code>points_threshold</code>, which defaults to <code>2</code>, an isolate will be (re)selected as a first weighted isolate.</p></li> <p>A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds <code>points_threshold</code>, which default to <code>2</code>, an isolate will be (re)selected as a first weighted isolate.</p></li>
</ol> </ol>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on Our Website!</h2> <h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on Our Website!</h2>

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -243,28 +243,33 @@
</div> </div>
<pre class="usage"><span class='fu'>mdro</span><span class='op'>(</span> <pre class="usage"><span class='fu'>mdro</span><span class='op'>(</span>
x <span class='op'>=</span> <span class='cn'>NULL</span>, <span class='va'>x</span>,
guideline <span class='op'>=</span> <span class='st'>"CMI2012"</span>, guideline <span class='op'>=</span> <span class='st'>"CMI2012"</span>,
col_mo <span class='op'>=</span> <span class='cn'>NULL</span>, col_mo <span class='op'>=</span> <span class='cn'>NULL</span>,
info <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span><span class='op'>(</span><span class='op'>)</span>, info <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/interactive.html'>interactive</a></span><span class='op'>(</span><span class='op'>)</span>,
pct_required_classes <span class='op'>=</span> <span class='fl'>0.5</span>, pct_required_classes <span class='op'>=</span> <span class='fl'>0.5</span>,
combine_SI <span class='op'>=</span> <span class='cn'>TRUE</span>, combine_SI <span class='op'>=</span> <span class='cn'>TRUE</span>,
verbose <span class='op'>=</span> <span class='cn'>FALSE</span>, verbose <span class='op'>=</span> <span class='cn'>FALSE</span>,
only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>,
<span class='va'>...</span> <span class='va'>...</span>
<span class='op'>)</span> <span class='op'>)</span>
<span class='fu'>custom_mdro_guideline</span><span class='op'>(</span><span class='va'>...</span>, as_factor <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> <span class='fu'>custom_mdro_guideline</span><span class='op'>(</span><span class='va'>...</span>, as_factor <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>
<span class='fu'>brmo</span><span class='op'>(</span>x <span class='op'>=</span> <span class='cn'>NULL</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span> <span class='fu'>brmo</span><span class='op'>(</span><span class='va'>x</span>, guideline <span class='op'>=</span> <span class='st'>"BRMO"</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'>mrgn</span><span class='op'>(</span>x <span class='op'>=</span> <span class='cn'>NULL</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span> <span class='fu'>mrgn</span><span class='op'>(</span><span class='va'>x</span>, guideline <span class='op'>=</span> <span class='st'>"MRGN"</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'>mdr_tb</span><span class='op'>(</span>x <span class='op'>=</span> <span class='cn'>NULL</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span> <span class='fu'>mdr_tb</span><span class='op'>(</span><span class='va'>x</span>, guideline <span class='op'>=</span> <span class='st'>"TB"</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'>mdr_cmi2012</span><span class='op'>(</span>x <span class='op'>=</span> <span class='cn'>NULL</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span> <span class='fu'>mdr_cmi2012</span><span class='op'>(</span><span class='va'>x</span>, guideline <span class='op'>=</span> <span class='st'>"CMI2012"</span>, only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>, <span class='va'>...</span><span class='op'>)</span>
<span class='fu'>eucast_exceptional_phenotypes</span><span class='op'>(</span>x <span class='op'>=</span> <span class='cn'>NULL</span>, only_rsi_columns <span class='op'>=</span> <span class='cn'>FALSE</span>, <span class='va'>...</span><span class='op'>)</span></pre> <span class='fu'>eucast_exceptional_phenotypes</span><span class='op'>(</span>
<span class='va'>x</span>,
guideline <span class='op'>=</span> <span class='st'>"EUCAST"</span>,
only_rsi_columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/any.html'>any</a></span><span class='op'>(</span><span class='fu'><a href='as.rsi.html'>is.rsi</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span><span class='op'>)</span>,
<span class='va'>...</span>
<span class='op'>)</span></pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments"> <table class="ref-arguments">
@ -299,7 +304,7 @@
</tr> </tr>
<tr> <tr>
<th>only_rsi_columns</th> <th>only_rsi_columns</th>
<td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand (defaults to <code>FALSE</code>)</p></td> <td><p>a logical to indicate whether only antibiotic columns must be detected that were <a href='[rsi]'>transformed to class <code>&lt;rsi&gt;</code></a> on beforehand. Defaults to <code>TRUE</code> if any column of <code>x</code> is of class <code>&lt;rsi&gt;</code>.</p></td>
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>

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

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

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

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9015</span>
</span> </span>
</div> </div>
@ -349,9 +349,9 @@
<p>The short name - <code>mo_shortname()</code> - almost always returns the first character of the genus and the full species, like <code>"E. coli"</code>. Exceptions are abbreviations of staphylococci (such as <em>"CoNS"</em>, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as <em>"GBS"</em>, Group B Streptococci). Please bear in mind that e.g. <em>E. coli</em> could mean <em>Escherichia coli</em> (kingdom of Bacteria) as well as <em>Entamoeba coli</em> (kingdom of Protozoa). Returning to the full name will be done using <code><a href='as.mo.html'>as.mo()</a></code> internally, giving priority to bacteria and human pathogens, i.e. <code>"E. coli"</code> will be considered <em>Escherichia coli</em>. In other words, <code>mo_fullname(mo_shortname("Entamoeba coli"))</code> returns <code>"Escherichia coli"</code>.</p> <p>The short name - <code>mo_shortname()</code> - almost always returns the first character of the genus and the full species, like <code>"E. coli"</code>. Exceptions are abbreviations of staphylococci (such as <em>"CoNS"</em>, Coagulase-Negative Staphylococci) and beta-haemolytic streptococci (such as <em>"GBS"</em>, Group B Streptococci). Please bear in mind that e.g. <em>E. coli</em> could mean <em>Escherichia coli</em> (kingdom of Bacteria) as well as <em>Entamoeba coli</em> (kingdom of Protozoa). Returning to the full name will be done using <code><a href='as.mo.html'>as.mo()</a></code> internally, giving priority to bacteria and human pathogens, i.e. <code>"E. coli"</code> will be considered <em>Escherichia coli</em>. In other words, <code>mo_fullname(mo_shortname("Entamoeba coli"))</code> returns <code>"Escherichia coli"</code>.</p>
<p>Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions <code>mo_kingdom()</code> and <code>mo_domain()</code> return the exact same results.</p> <p>Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions <code>mo_kingdom()</code> and <code>mo_domain()</code> return the exact same results.</p>
<p>The Gram stain - <code>mo_gramstain()</code> - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, <a href='https://pubmed.ncbi.nlm.nih.gov/11837318'>PMID 11837318</a>), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value <code>NA</code>. Functions <code>mo_is_gram_negative()</code> and <code>mo_is_gram_positive()</code> always return <code>TRUE</code> or <code>FALSE</code> (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>), thus always return <code>FALSE</code> for species outside the taxonomic kingdom of Bacteria.</p> <p>The Gram stain - <code>mo_gramstain()</code> - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, <a href='https://pubmed.ncbi.nlm.nih.gov/11837318'>PMID 11837318</a>), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value <code>NA</code>. Functions <code>mo_is_gram_negative()</code> and <code>mo_is_gram_positive()</code> always return <code>TRUE</code> or <code>FALSE</code> (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>), thus always return <code>FALSE</code> for species outside the taxonomic kingdom of Bacteria.</p>
<p>Determination of yeasts - <code>mo_is_yeast()</code> - will be based on the taxonomic kingdom and class. <em>Budding yeasts</em> are fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). <em>True yeasts</em> are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are fungi and member of the taxonomic class Saccharomycetes, the function will return <code>TRUE</code>. It returns <code>FALSE</code> otherwise (except when the input is <code>NA</code> or the MO code is <code>UNKNOWN</code>).</p> <p>Determination of yeasts - <code>mo_is_yeast()</code> - will be based on the taxonomic phylum, class and order. Budding yeasts are true fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). The true yeasts are separated into one main order Saccharomycetales. For all microorganisms that are in one of those two groups, the function will return <code>TRUE</code>. It returns <code>FALSE</code> for all other taxonomic entries.</p>
<p>Intrinsic resistance - <code>mo_is_intrinsic_resistant()</code> - will be determined based on the <a href='intrinsic_resistant.html'>intrinsic_resistant</a> data set, which is based on <a href='https://www.eucast.org/expert_rules_and_intrinsic_resistance/'>'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2</a> (2020). The <code>mo_is_intrinsic_resistant()</code> functions can be vectorised over arguments <code>x</code> (input for microorganisms) and over <code>ab</code> (input for antibiotics).</p> <p>Intrinsic resistance - <code>mo_is_intrinsic_resistant()</code> - will be determined based on the <a href='intrinsic_resistant.html'>intrinsic_resistant</a> data set, which is based on <a href='https://www.eucast.org/expert_rules_and_intrinsic_resistance/'>'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2</a> (2020). The <code>mo_is_intrinsic_resistant()</code> can be vectorised over arguments <code>x</code> (input for microorganisms) and over <code>ab</code> (input for antibiotics).</p>
<p>All output <a href='translate.html'>will be translated</a> where possible.</p> <p>All output will be <a href='translate.html'>translate</a>d where possible.</p>
<p>The function <code>mo_url()</code> will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.</p> <p>The function <code>mo_url()</code> will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.</p>
<h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2> <h2 class="hasAnchor" id="stable-lifecycle"><a class="anchor" href="#stable-lifecycle"></a>Stable Lifecycle</h2>

@ -83,7 +83,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>

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

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

@ -83,7 +83,7 @@ resistance() should be used to calculate resistance, susceptibility() should be
</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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>

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

@ -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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>
@ -287,7 +287,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup> <colgroup><col class="name" /><col class="desc" /></colgroup>
<tr> <tr>
<th>x</th> <th>x</th>
<td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates. Can be left blank for automatic determination, see <em>Examples</em>.</p></td> <td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates. Can be left blank for automatic determination.</p></td>
</tr> </tr>
<tr> <tr>
<th>col_ab</th> <th>col_ab</th>

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

@ -83,7 +83,7 @@ When negative ('left-skewed'): the left tail is longer; the mass of the distribu
</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.5.0.9016</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.5.0.9014</span>
</span> </span>
</div> </div>

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

@ -1,6 +1,6 @@
# `AMR` (for R) <img src="./logo.png" align="right" height="120px" /> # `AMR` (for R) <img src="./logo.png" align="right" height="120px" />
*Note: the rules of 'EUCAST Clinical Breakpoints v11.0 (2021)' are implemented in [the latest beta version](./#latest-development-version), awaiting the next stable release (expected end of February)* *Note: the rules of 'EUCAST Clinical Breakpoints v11.0 (2021)' will be added in the next release, to be expected in February/March 2021.*
> <span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> **PLEASE TAKE PART IN OUR SURVEY!** > <span class="fa fa-clipboard-list" style="color: #128f76; font-size: 20pt; margin-right: 5px;"></span> **PLEASE TAKE PART IN OUR SURVEY!**
> Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. **If you have a minute, please [anonymously fill in this short questionnaire](./survey.html)**. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance! > Since you are one of our users, we would like to know how you use the package and what it brought you or your organisation. **If you have a minute, please [anonymously fill in this short questionnaire](./survey.html)**. Your valuable input will help to improve the package and its functionalities. You can answer the open questions in either English, Spanish, French, Dutch, or German. Thank you very much in advance!
@ -39,9 +39,9 @@ example_isolates %>%
#> NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant() #> NOTE: Using column 'mo' as input for mo_is_intrinsic_resistant()
#> NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and #> NOTE: Determining intrinsic resistance based on 'EUCAST Expert Rules' and
#> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020). #> 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2 (2020).
#> Selecting aminoglycosides: columns 'AMK' (amikacin), 'GEN' (gentamicin), #> Selecting aminoglycosides: 'AMK' (amikacin), 'GEN' (gentamicin),
#> 'KAN' (kanamycin) and 'TOB' (tobramycin) #> 'KAN' (kanamycin), 'TOB' (tobramycin)
#> Selecting carbapenems: columns 'IPM' (imipenem) and 'MEM' (meropenem) #> Selecting carbapenems: 'IPM' (imipenem), 'MEM' (meropenem)
``` ```
With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antibiotics](./reference/antibiotics.html) in the `AMR` package make sure you get what you meant: With only having defined a row filter on Gram-negative bacteria with intrinsic resistance to cefotaxime (`mo_is_gram_negative()` and `mo_is_intrinsic_resistant()`) and a column selection on two antibiotic groups (`aminoglycosides()` and `carbapenems()`), the reference data about [all microorganisms](./reference/microorganisms.html) and [all antibiotics](./reference/antibiotics.html) in the `AMR` package make sure you get what you meant:

@ -72,7 +72,7 @@ ab_property(x, property = "name", language = get_locale(), ...)
Use these functions to return a specific property of an antibiotic from the \link{antibiotics} data set. All input values will be evaluated internally with \code{\link[=as.ab]{as.ab()}}. Use these functions to return a specific property of an antibiotic from the \link{antibiotics} data set. All input values will be evaluated internally with \code{\link[=as.ab]{as.ab()}}.
} }
\details{ \details{
All output \link[=translate]{will be translated} where possible. All output will be \link{translate}d where possible.
The function \code{\link[=ab_url]{ab_url()}} will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available. The function \code{\link[=ab_url]{ab_url()}} will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.
} }

@ -14,45 +14,42 @@
\alias{fluoroquinolones} \alias{fluoroquinolones}
\alias{glycopeptides} \alias{glycopeptides}
\alias{macrolides} \alias{macrolides}
\alias{oxazolidinones}
\alias{penicillins} \alias{penicillins}
\alias{tetracyclines} \alias{tetracyclines}
\title{Antibiotic Class Selectors} \title{Antibiotic Class Selectors}
\usage{ \usage{
ab_class(ab_class, only_rsi_columns = FALSE) ab_class(ab_class, only_rsi_columns = NULL)
aminoglycosides(only_rsi_columns = FALSE) aminoglycosides(only_rsi_columns = NULL)
carbapenems(only_rsi_columns = FALSE) carbapenems(only_rsi_columns = NULL)
cephalosporins(only_rsi_columns = FALSE) cephalosporins(only_rsi_columns = NULL)
cephalosporins_1st(only_rsi_columns = FALSE) cephalosporins_1st(only_rsi_columns = NULL)
cephalosporins_2nd(only_rsi_columns = FALSE) cephalosporins_2nd(only_rsi_columns = NULL)
cephalosporins_3rd(only_rsi_columns = FALSE) cephalosporins_3rd(only_rsi_columns = NULL)
cephalosporins_4th(only_rsi_columns = FALSE) cephalosporins_4th(only_rsi_columns = NULL)
cephalosporins_5th(only_rsi_columns = FALSE) cephalosporins_5th(only_rsi_columns = NULL)
fluoroquinolones(only_rsi_columns = FALSE) fluoroquinolones(only_rsi_columns = NULL)
glycopeptides(only_rsi_columns = FALSE) glycopeptides(only_rsi_columns = NULL)
macrolides(only_rsi_columns = FALSE) macrolides(only_rsi_columns = NULL)
oxazolidinones(only_rsi_columns = FALSE) penicillins(only_rsi_columns = NULL)
penicillins(only_rsi_columns = FALSE) tetracyclines(only_rsi_columns = NULL)
tetracyclines(only_rsi_columns = FALSE)
} }
\arguments{ \arguments{
\item{ab_class}{an antimicrobial class, like \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.} \item{ab_class}{an antimicrobial class, like \code{"carbapenems"}. The columns \code{group}, \code{atc_group1} and \code{atc_group2} of the \link{antibiotics} data set will be searched (case-insensitive) for this value.}
\item{only_rsi_columns}{a logical to indicate whether only columns of class \href{[rsi]}{\verb{<rsi>}} must be selected (defaults to \code{FALSE})} \item{only_rsi_columns}{a logical to indicate whether only columns of class \href{[rsi]}{\verb{<rsi>}} must be selected. If set to \code{NULL} (default), it will be \code{TRUE} if any column of the data was \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand, and \code{FALSE} otherwise.}
} }
\description{ \description{
These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}} These functions help to select the columns of antibiotics that are of a specific antibiotic class, without the need to define the columns or antibiotic abbreviations. \strong{\Sexpr{ifelse(as.double(R.Version()$major) + (as.double(R.Version()$minor) / 10) < 3.2, paste0("NOTE: THESE FUNCTIONS DO NOT WORK ON YOUR CURRENT R VERSION. These functions require R version 3.2 or later - you have ", R.version.string, "."), "")}}

@ -26,7 +26,7 @@ eucast_rules(
version_breakpoints = 11, version_breakpoints = 11,
version_expertrules = 3.2, version_expertrules = 3.2,
ampc_cephalosporin_resistance = NA, ampc_cephalosporin_resistance = NA,
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
... ...
) )
@ -49,7 +49,7 @@ eucast_dosage(ab, administration = "iv", version_breakpoints = 11)
\item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia} and \emph{Serratia}.} \item{ampc_cephalosporin_resistance}{a character value that should be applied for AmpC de-repressed cephalosporin-resistant mutants, defaults to \code{NA}. Currently only works when \code{version_expertrules} is \code{3.2}; '\emph{EUCAST Expert Rules v3.2 on Enterobacterales}' states that results of cefotaxime, ceftriaxone and ceftazidime should be reported with a note, or results should be suppressed (emptied) for these agents. A value of \code{NA} for this argument will remove results for these agents, while e.g. a value of \code{"R"} will make the results for these agents resistant. Use \code{NULL} to not alter the results for AmpC de-repressed cephalosporin-resistant mutants. \cr For \emph{EUCAST Expert Rules} v3.2, this rule applies to: \emph{Citrobacter braakii}, \emph{Citrobacter freundii}, \emph{Citrobacter gillenii}, \emph{Citrobacter murliniae}, \emph{Citrobacter rodenticum}, \emph{Citrobacter sedlakii}, \emph{Citrobacter werkmanii}, \emph{Citrobacter youngae}, \emph{Enterobacter}, \emph{Hafnia alvei}, \emph{Klebsiella aerogenes}, \emph{Morganella morganii}, \emph{Providencia} and \emph{Serratia}.}
\item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand (defaults to \code{FALSE})} \item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand. Defaults to \code{TRUE} if any column of \code{x} is of class \verb{<rsi>}.}
\item{...}{column name of an antibiotic, see section \emph{Antibiotics} below} \item{...}{column name of an antibiotic, see section \emph{Antibiotics} below}

@ -13,7 +13,6 @@
\alias{filter_fluoroquinolones} \alias{filter_fluoroquinolones}
\alias{filter_glycopeptides} \alias{filter_glycopeptides}
\alias{filter_macrolides} \alias{filter_macrolides}
\alias{filter_oxazolidinones}
\alias{filter_penicillins} \alias{filter_penicillins}
\alias{filter_tetracyclines} \alias{filter_tetracyclines}
\title{Filter Isolates on Result in Antimicrobial Class} \title{Filter Isolates on Result in Antimicrobial Class}
@ -23,121 +22,35 @@ filter_ab_class(
ab_class, ab_class,
result = NULL, result = NULL,
scope = "any", scope = "any",
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
... ...
) )
filter_aminoglycosides( filter_aminoglycosides(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_carbapenems( filter_carbapenems(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_cephalosporins( filter_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_1st_cephalosporins( filter_1st_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_2nd_cephalosporins( filter_2nd_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_3rd_cephalosporins( filter_3rd_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_4th_cephalosporins( filter_4th_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_5th_cephalosporins( filter_5th_cephalosporins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_fluoroquinolones( filter_fluoroquinolones(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_glycopeptides( filter_glycopeptides(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_macrolides( filter_macrolides(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_oxazolidinones( filter_penicillins(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_penicillins( filter_tetracyclines(x, result = NULL, scope = "any", ...)
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
filter_tetracyclines(
x,
result = NULL,
scope = "any",
only_rsi_columns = FALSE,
...
)
} }
\arguments{ \arguments{
\item{x}{a data set} \item{x}{a data set}
@ -148,7 +61,7 @@ filter_tetracyclines(
\item{scope}{the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}} \item{scope}{the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}}
\item{only_rsi_columns}{a logical to indicate whether only columns must be included that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand (defaults to \code{FALSE})} \item{only_rsi_columns}{a logical to indicate whether only columns must be included that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand. Defaults to \code{TRUE} if any column of \code{x} is of class \verb{<rsi>}.}
\item{...}{arguments passed on to \code{\link[=filter_ab_class]{filter_ab_class()}}} \item{...}{arguments passed on to \code{\link[=filter_ab_class]{filter_ab_class()}}}
} }

@ -12,7 +12,7 @@ Methodology of this function is strictly based on:
} }
\usage{ \usage{
first_isolate( first_isolate(
x = NULL, x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
@ -33,7 +33,7 @@ first_isolate(
) )
filter_first_isolate( filter_first_isolate(
x = NULL, x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
@ -41,7 +41,7 @@ filter_first_isolate(
) )
filter_first_weighted_isolate( filter_first_weighted_isolate(
x = NULL, x,
col_date = NULL, col_date = NULL,
col_patient_id = NULL, col_patient_id = NULL,
col_mo = NULL, col_mo = NULL,
@ -50,7 +50,7 @@ filter_first_weighted_isolate(
) )
} }
\arguments{ \arguments{
\item{x}{a \link{data.frame} containing isolates. Can be left blank for automatic determination, see \emph{Examples}.} \item{x}{a \link{data.frame} containing isolates. Can be left blank for automatic determination.}
\item{col_date}{column name of the result date (or date that is was received on the lab), defaults to the first column with a date class} \item{col_date}{column name of the result date (or date that is was received on the lab), defaults to the first column with a date class}
@ -130,7 +130,7 @@ There are two ways to determine whether isolates can be included as first weight
Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With \code{ignore_I = FALSE}, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the \code{\link[=key_antibiotics]{key_antibiotics()}} function. Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With \code{ignore_I = FALSE}, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the \code{\link[=key_antibiotics]{key_antibiotics()}} function.
\item Using \code{type = "points"} and argument \code{points_threshold} \item Using \code{type = "points"} and argument \code{points_threshold}
A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, which defaults to \code{2}, an isolate will be (re)selected as a first weighted isolate. A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, which default to \code{2}, an isolate will be (re)selected as a first weighted isolate.
} }
} }
@ -151,12 +151,10 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
# `example_isolates` is a data set available in the AMR package. # `example_isolates` is a data set available in the AMR package.
# See ?example_isolates. # See ?example_isolates.
example_isolates[first_isolate(example_isolates), ] # basic filtering on first isolates
\donttest{
# faster way, only works in R 3.2 and later:
example_isolates[first_isolate(), ] example_isolates[first_isolate(), ]
\donttest{
# get all first Gram-negatives # get all first Gram-negatives
example_isolates[which(first_isolate() & mo_is_gram_negative()), ] example_isolates[which(first_isolate() & mo_is_gram_negative()), ]

@ -8,7 +8,7 @@ guess_ab_col(
x = NULL, x = NULL,
search_string = NULL, search_string = NULL,
verbose = FALSE, verbose = FALSE,
only_rsi_columns = FALSE only_rsi_columns = any(is.rsi(x))
) )
} }
\arguments{ \arguments{
@ -18,7 +18,7 @@ guess_ab_col(
\item{verbose}{a logical to indicate whether additional info should be printed} \item{verbose}{a logical to indicate whether additional info should be printed}
\item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand (defaults to \code{FALSE})} \item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand. Defaults to \code{TRUE} if any column of \code{x} is of class \verb{<rsi>}.}
} }
\value{ \value{
A column name of \code{x}, or \code{NULL} when no result is found. A column name of \code{x}, or \code{NULL} when no result is found.

@ -6,7 +6,7 @@
\title{Key Antibiotics for First (Weighted) Isolates} \title{Key Antibiotics for First (Weighted) Isolates}
\usage{ \usage{
key_antibiotics( key_antibiotics(
x = NULL, x,
col_mo = NULL, col_mo = NULL,
universal_1 = guess_ab_col(x, "amoxicillin"), universal_1 = guess_ab_col(x, "amoxicillin"),
universal_2 = guess_ab_col(x, "amoxicillin/clavulanic acid"), universal_2 = guess_ab_col(x, "amoxicillin/clavulanic acid"),
@ -125,7 +125,7 @@ There are two ways to determine whether isolates can be included as first weight
Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With \code{ignore_I = FALSE}, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the \code{\link[=key_antibiotics]{key_antibiotics()}} function. Any difference from S to R (or vice versa) will (re)select an isolate as a first weighted isolate. With \code{ignore_I = FALSE}, also differences from I to S|R (or vice versa) will lead to this. This is a reliable method and 30-35 times faster than method 2. Read more about this in the \code{\link[=key_antibiotics]{key_antibiotics()}} function.
\item Using \code{type = "points"} and argument \code{points_threshold} \item Using \code{type = "points"} and argument \code{points_threshold}
A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, which defaults to \code{2}, an isolate will be (re)selected as a first weighted isolate. A difference from I to S|R (or vice versa) means 0.5 points, a difference from S to R (or vice versa) means 1 point. When the sum of points exceeds \code{points_threshold}, which default to \code{2}, an isolate will be (re)selected as a first weighted isolate.
} }
} }

@ -20,28 +20,33 @@ See the supported guidelines above for the list of publications used for this fu
} }
\usage{ \usage{
mdro( mdro(
x = NULL, x,
guideline = "CMI2012", guideline = "CMI2012",
col_mo = NULL, col_mo = NULL,
info = interactive(), info = interactive(),
pct_required_classes = 0.5, pct_required_classes = 0.5,
combine_SI = TRUE, combine_SI = TRUE,
verbose = FALSE, verbose = FALSE,
only_rsi_columns = FALSE, only_rsi_columns = any(is.rsi(x)),
... ...
) )
custom_mdro_guideline(..., as_factor = TRUE) custom_mdro_guideline(..., as_factor = TRUE)
brmo(x = NULL, only_rsi_columns = FALSE, ...) brmo(x, guideline = "BRMO", only_rsi_columns = any(is.rsi(x)), ...)
mrgn(x = NULL, only_rsi_columns = FALSE, ...) mrgn(x, guideline = "MRGN", only_rsi_columns = any(is.rsi(x)), ...)
mdr_tb(x = NULL, only_rsi_columns = FALSE, ...) mdr_tb(x, guideline = "TB", only_rsi_columns = any(is.rsi(x)), ...)
mdr_cmi2012(x = NULL, only_rsi_columns = FALSE, ...) mdr_cmi2012(x, guideline = "CMI2012", only_rsi_columns = any(is.rsi(x)), ...)
eucast_exceptional_phenotypes(x = NULL, only_rsi_columns = FALSE, ...) eucast_exceptional_phenotypes(
x,
guideline = "EUCAST",
only_rsi_columns = any(is.rsi(x)),
...
)
} }
\arguments{ \arguments{
\item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank for automatic determination.} \item{x}{a \link{data.frame} with antibiotics columns, like \code{AMX} or \code{amox}. Can be left blank for automatic determination.}
@ -58,7 +63,7 @@ eucast_exceptional_phenotypes(x = NULL, only_rsi_columns = FALSE, ...)
\item{verbose}{a logical to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.} \item{verbose}{a logical to turn Verbose mode on and off (default is off). In Verbose mode, the function does not return the MDRO results, but instead returns a data set in logbook form with extensive info about which isolates would be MDRO-positive, or why they are not.}
\item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand (defaults to \code{FALSE})} \item{only_rsi_columns}{a logical to indicate whether only antibiotic columns must be detected that were \href{[rsi]}{transformed to class \verb{<rsi>}} on beforehand. Defaults to \code{TRUE} if any column of \code{x} is of class \verb{<rsi>}.}
\item{...}{in case of \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}}: a set of rules, see section \emph{Using Custom Guidelines} below. Otherwise: column name of an antibiotic, see section \emph{Antibiotics} below.} \item{...}{in case of \code{\link[=custom_mdro_guideline]{custom_mdro_guideline()}}: a set of rules, see section \emph{Using Custom Guidelines} below. Otherwise: column name of an antibiotic, see section \emph{Antibiotics} below.}

@ -126,11 +126,11 @@ Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and so
The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, \href{https://pubmed.ncbi.nlm.nih.gov/11837318}{PMID 11837318}), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}. Functions \code{\link[=mo_is_gram_negative]{mo_is_gram_negative()}} and \code{\link[=mo_is_gram_positive]{mo_is_gram_positive()}} always return \code{TRUE} or \code{FALSE} (except when the input is \code{NA} or the MO code is \code{UNKNOWN}), thus always return \code{FALSE} for species outside the taxonomic kingdom of Bacteria. The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, \href{https://pubmed.ncbi.nlm.nih.gov/11837318}{PMID 11837318}), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}. Functions \code{\link[=mo_is_gram_negative]{mo_is_gram_negative()}} and \code{\link[=mo_is_gram_positive]{mo_is_gram_positive()}} always return \code{TRUE} or \code{FALSE} (except when the input is \code{NA} or the MO code is \code{UNKNOWN}), thus always return \code{FALSE} for species outside the taxonomic kingdom of Bacteria.
Determination of yeasts - \code{\link[=mo_is_yeast]{mo_is_yeast()}} - will be based on the taxonomic kingdom and class. \emph{Budding yeasts} are fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). \emph{True yeasts} are aggregated into the underlying order Saccharomycetales. Thus, for all microorganisms that are fungi and member of the taxonomic class Saccharomycetes, the function will return \code{TRUE}. It returns \code{FALSE} otherwise (except when the input is \code{NA} or the MO code is \code{UNKNOWN}). Determination of yeasts - \code{\link[=mo_is_yeast]{mo_is_yeast()}} - will be based on the taxonomic phylum, class and order. Budding yeasts are true fungi of the phylum Ascomycetes, class Saccharomycetes (also called Hemiascomycetes). The true yeasts are separated into one main order Saccharomycetales. For all microorganisms that are in one of those two groups, the function will return \code{TRUE}. It returns \code{FALSE} for all other taxonomic entries.
Intrinsic resistance - \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} - will be determined based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_intrinsic_resistance/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2} (2020). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} functions can be vectorised over arguments \code{x} (input for microorganisms) and over \code{ab} (input for antibiotics). Intrinsic resistance - \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} - will be determined based on the \link{intrinsic_resistant} data set, which is based on \href{https://www.eucast.org/expert_rules_and_intrinsic_resistance/}{'EUCAST Expert Rules' and 'EUCAST Intrinsic Resistance and Unusual Phenotypes' v3.2} (2020). The \code{\link[=mo_is_intrinsic_resistant]{mo_is_intrinsic_resistant()}} can be vectorised over arguments \code{x} (input for microorganisms) and over \code{ab} (input for antibiotics).
All output \link[=translate]{will be translated} where possible. All output will be \link{translate}d where possible.
The function \code{\link[=mo_url]{mo_url()}} will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species. The function \code{\link[=mo_url]{mo_url()}} will return the direct URL to the online database entry, which also shows the scientific reference of the concerned species.
} }

@ -47,7 +47,7 @@ ggplot_rsi_predict(
) )
} }
\arguments{ \arguments{
\item{x}{a \link{data.frame} containing isolates. Can be left blank for automatic determination, see \emph{Examples}.} \item{x}{a \link{data.frame} containing isolates. Can be left blank for automatic determination.}
\item{col_ab}{column name of \code{x} containing antimicrobial interpretations (\code{"R"}, \code{"I"} and \code{"S"})} \item{col_ab}{column name of \code{x} containing antimicrobial interpretations (\code{"R"}, \code{"I"} and \code{"S"})}

@ -54,12 +54,3 @@ test_that("looking up ab columns works", {
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = TRUE)) expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = TRUE))
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE)) expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE))
}) })
test_that("looking up ab columns works", {
skip_on_cran()
library(dplyr)
# we rely on "grouped_tbl" being a class of grouped tibbles, so:
expect_true(is_null_or_grouped_tbl(example_isolates %>% group_by(hospital_id)))
})

@ -39,7 +39,6 @@ test_that("Antibiotic class selectors work", {
expect_lt(example_isolates %>% dplyr::select(fluoroquinolones()) %>% ncol(), ncol(example_isolates)) expect_lt(example_isolates %>% dplyr::select(fluoroquinolones()) %>% ncol(), ncol(example_isolates))
expect_lt(example_isolates %>% dplyr::select(glycopeptides()) %>% ncol(), ncol(example_isolates)) expect_lt(example_isolates %>% dplyr::select(glycopeptides()) %>% ncol(), ncol(example_isolates))
expect_lt(example_isolates %>% dplyr::select(macrolides()) %>% ncol(), ncol(example_isolates)) expect_lt(example_isolates %>% dplyr::select(macrolides()) %>% ncol(), ncol(example_isolates))
expect_lt(example_isolates %>% dplyr::select(oxazolidinones()) %>% ncol(), ncol(example_isolates))
expect_lt(example_isolates %>% dplyr::select(penicillins()) %>% ncol(), ncol(example_isolates)) expect_lt(example_isolates %>% dplyr::select(penicillins()) %>% ncol(), ncol(example_isolates))
expect_lt(example_isolates %>% dplyr::select(tetracyclines()) %>% ncol(), ncol(example_isolates)) expect_lt(example_isolates %>% dplyr::select(tetracyclines()) %>% ncol(), ncol(example_isolates))

@ -30,20 +30,17 @@ test_that("ATC-group filtering works", {
library(dplyr) library(dplyr)
expect_gt(example_isolates %>% filter_ab_class("carbapenem") %>% nrow(), 0) expect_gt(example_isolates %>% filter_ab_class("carbapenem") %>% nrow(), 0)
expect_gt(example_isolates %>% filter_aminoglycosides() %>% ncol(), 0) expect_gt(example_isolates %>% filter_aminoglycosides() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_carbapenems() %>% ncol(), 0) expect_gt(example_isolates %>% filter_carbapenems() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_cephalosporins() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_1st_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_1st_cephalosporins() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_2nd_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_2nd_cephalosporins() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_3rd_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_3rd_cephalosporins() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_4th_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_4th_cephalosporins() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_5th_cephalosporins() %>% ncol(), 0) expect_gt(example_isolates %>% filter_fluoroquinolones() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_fluoroquinolones() %>% ncol(), 0) expect_gt(example_isolates %>% filter_glycopeptides() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_glycopeptides() %>% ncol(), 0) expect_gt(example_isolates %>% filter_macrolides() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_macrolides() %>% ncol(), 0) expect_gt(example_isolates %>% filter_tetracyclines() %>% nrow(), 0)
expect_gt(example_isolates %>% filter_oxazolidinones() %>% ncol(), 0)
expect_gt(example_isolates %>% filter_penicillins() %>% ncol(), 0)
expect_gt(example_isolates %>% filter_tetracyclines() %>% ncol(), 0)
expect_gt(example_isolates %>% filter_carbapenems("R", "all") %>% nrow(), 0) expect_gt(example_isolates %>% filter_carbapenems("R", "all") %>% nrow(), 0)

Some files were not shown because too many files have changed in this diff Show More