mirror of
https://github.com/msberends/AMR.git
synced 2025-07-10 04:21:59 +02:00
(v2.1.1.9223) allow +
ab
This commit is contained in:
@ -539,7 +539,7 @@ word_wrap <- function(...,
|
||||
)
|
||||
# text starting with `?` must also lead to the help page
|
||||
parts[parts %like% "^[?]"] <- font_url(
|
||||
url = paste0("ide:help:AMR::", parts[parts %like% "^[?]"]),
|
||||
url = paste0("ide:help:AMR::", gsub("?", "", parts[parts %like% "^[?]"], fixed = TRUE)),
|
||||
txt = parts[parts %like% "^[?]"]
|
||||
)
|
||||
msg <- paste0(parts, collapse = "`")
|
||||
|
10
R/ab.R
10
R/ab.R
@ -610,6 +610,16 @@ rep.ab <- function(x, ...) {
|
||||
y
|
||||
}
|
||||
|
||||
#' @method + ab
|
||||
#' @export
|
||||
#' @noRd
|
||||
`+.ab` <- function(e1, e2) {
|
||||
# this does not return ab class, it should just allow console usage of e.g., carbapenems() + c("", aminoglycosides())
|
||||
out <- as.character(outer(e1, e2, paste, sep = " + "))
|
||||
out <- gsub(" [+] $", "", out)
|
||||
out
|
||||
}
|
||||
|
||||
generalise_antibiotic_name <- function(x) {
|
||||
x <- toupper(x)
|
||||
# remove suffices
|
||||
|
@ -954,9 +954,10 @@ any.amr_selector_any_all <- function(..., na.rm = FALSE) {
|
||||
#' @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")
|
||||
)
|
||||
# this is also implemented for ab class, to allow direct console usage
|
||||
out <- as.character(outer(e1, e2, paste, sep = " + "))
|
||||
out <- gsub(" [+] $", "", out)
|
||||
structure(out, class = c("amr_selector", "character"))
|
||||
}
|
||||
|
||||
is_any <- function(el1) {
|
||||
|
@ -42,8 +42,9 @@
|
||||
#' - `c(aminoglycosides(), "AMP", "AMC")`
|
||||
#' - `c(aminoglycosides(), carbapenems())`
|
||||
#' - Combination therapy, indicated by using `"+"`, with or without [antimicrobial selectors][antimicrobial_selectors], e.g.:
|
||||
#' - `"TZP+TOB"`
|
||||
#' - `"cipro + genta"`
|
||||
#' - `"TZP+TOB"`
|
||||
#' - `c("TZP", "TZP+GEN", "TZP+TOB")`
|
||||
#' - `carbapenems() + "GEN"`
|
||||
#' - `carbapenems() + c("", "GEN")`
|
||||
#' - `carbapenems() + c("", aminoglycosides())`
|
||||
|
Reference in New Issue
Block a user