1
0
mirror of https://github.com/msberends/AMR.git synced 2026-06-29 16:56:21 +02:00

(v3.0.1.9070) Fix #293, update EUCAST rules for PEF

This commit is contained in:
2026-06-26 08:56:59 +02:00
parent 4fac683fac
commit 637ada920b
8 changed files with 31 additions and 1553 deletions

12
R/sir.R
View File

@@ -73,6 +73,7 @@ VALID_SIR_LEVELS <- c("S", "SDD", "I", "R", "NI", "WT", "NWT", "NS")
#' @param threshold Maximum fraction of invalid antimicrobial interpretations of `x`, see *Examples*.
#' @param conserve_capped_values Deprecated, use `capped_mic_handling` instead.
#' @param ... For using on a [data.frame]: selection of columns to apply `as.sir()` to. Supports [tidyselect language][tidyselect::starts_with()] such as `where(is.mic)`, `starts_with(...)`, or `column1:column4`, and can thus also be [antimicrobial selectors][amr_selector()], e.g. `as.sir(df, penicillins())`.
#' @param enforce_method A [character] string to force interpretation as a specific method, useful when the S3 class of `x` is lost (e.g., when called from Python via rpy2). Must be one of `"auto"` (default), `"mic"`, or `"disk"`.
#'
#' Otherwise: arguments passed on to methods.
#' @details
@@ -385,8 +386,15 @@ VALID_SIR_LEVELS <- c("S", "SDD", "I", "R", "NI", "WT", "NWT", "NS")
#' # mutate(across(where(is_sir_eligible), as.sir))
#' }
#' }
as.sir <- function(x, ...) {
UseMethod("as.sir")
as.sir <- function(x, ..., enforce_method = "auto") {
meet_criteria(enforce_method, allow_class = "character", has_length = 1, is_in = c("auto", "mic", "disk"))
if (enforce_method == "mic") {
as.sir.mic(x, ...)
} else if (enforce_method == "disk") {
as.sir.disk(x, ...)
} else {
UseMethod("as.sir")
}
}
as_sir_structure <- function(x,