1
0
mirror of https://github.com/msberends/AMR.git synced 2026-02-09 13:12:58 +01:00

(v3.0.1.9019) Wildtype/Non-wildtype support, and start with interpretive_rules()

Fixes #246
Fixes #254
Fixes #255
Fixes #256
This commit is contained in:
2026-02-08 23:15:40 +01:00
parent 2df2911cf4
commit ba4c159154
31 changed files with 394 additions and 165 deletions

View File

@@ -231,7 +231,7 @@ resistance <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "R",
ab_result = c("R", "NWT", "NS"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -249,7 +249,7 @@ susceptibility <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "SDD", "I"),
ab_result = c("S", "SDD", "I", "WT"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -269,7 +269,7 @@ sir_confidence_interval <- function(...,
confidence_level = 0.95,
side = "both",
collapse = FALSE) {
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = c(1:5), is_in = c("S", "SDD", "I", "R", "NI"))
meet_criteria(ab_result, allow_class = c("character", "sir"), has_length = seq_along(VALID_SIR_LEVELS), is_in = VALID_SIR_LEVELS)
meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE)
meet_criteria(as_percent, allow_class = "logical", has_length = 1)
meet_criteria(only_all_tested, allow_class = "logical", has_length = 1)
@@ -287,7 +287,7 @@ sir_confidence_interval <- function(...,
)
n <- tryCatch(
sir_calc(...,
ab_result = c("S", "SDD", "I", "R", "NI"),
ab_result = VALID_SIR_LEVELS,
only_all_tested = only_all_tested,
only_count = TRUE
),
@@ -341,7 +341,7 @@ proportion_R <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "R",
ab_result = c("R", "NWT", "NS"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -359,7 +359,7 @@ proportion_IR <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("I", "SDD", "R"),
ab_result = c("I", "SDD", "R", "NWT", "NS"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -395,7 +395,7 @@ proportion_SI <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = c("S", "I", "SDD"),
ab_result = c("S", "I", "SDD", "WT"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,
@@ -413,7 +413,7 @@ proportion_S <- function(...,
only_all_tested = FALSE) {
tryCatch(
sir_calc(...,
ab_result = "S",
ab_result = c("S", "WT"),
minimum = minimum,
as_percent = as_percent,
only_all_tested = only_all_tested,