mirror of
https://github.com/msberends/AMR.git
synced 2025-09-06 00:09:56 +02:00
(v2.1.1.9217) allow + in amr selectors
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
#' Antimicrobial Selectors
|
||||
#'
|
||||
#' @description These functions allow for filtering rows and selecting columns based on antimicrobial test results that are of a specific antimicrobial class or group, without the need to define the columns or antimicrobial abbreviations.
|
||||
#' @description These functions allow for filtering rows and selecting columns based on antimicrobial test results that are of a specific antimicrobial class or group, without the need to define the columns or antimicrobial abbreviations. They can be used in base \R, tidyverse, tidymodels, and `data.table`.
|
||||
#'
|
||||
#' In short, if you have a column name that resembles an antimicrobial drug, it will be picked up by any of these functions that matches its pharmaceutical class: "cefazolin", "kefzol", "CZO" and "J01DB04" will all be picked up using:
|
||||
#'
|
||||
@@ -949,6 +949,15 @@ any.amr_selector_any_all <- function(..., na.rm = FALSE) {
|
||||
class = c("amr_selector", "character")
|
||||
)
|
||||
}
|
||||
#' @method + amr_selector
|
||||
#' @export
|
||||
#' @noRd
|
||||
`+.amr_selector` <- function(e1, e2) {
|
||||
# this is useful for `antibiogram()`: antibiogram(example_isolates, carbapenems() + c("", "GEN", "TOB"))
|
||||
structure(as.character(outer(e1, e2, paste, sep = " + ")),
|
||||
class = c("amr_selector", "character")
|
||||
)
|
||||
}
|
||||
|
||||
is_any <- function(el1) {
|
||||
syscalls <- paste0(trimws2(deparse(sys.calls())), collapse = " ")
|
||||
|
Reference in New Issue
Block a user