Let aggregated analyses follow the guideline for the 'I' category in count_df(), proportion_df(), sir_df(), the plotting functions, antibiogram(), wisca(), and bug_drug_combinations(), deprecate combine_SI in favour of guideline, fix format() on bug_drug_combinations() counting I as resistant, and add a shared section 'Interpretation of SIR'

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-15 09:58:21 +02:00
1 parent dbd95ffa46
commit 0efc8826c8
32 files changed
+511 -199

No files matched your search

+14 -1
View File
@@ -111,14 +111,27 @@ test_that("test-count.R", {
old_opts <- options(AMR_guideline = "CLSI")
expect_identical(count_df(example_isolates[, "AMX"]), count_df(example_isolates[, "AMX"], guideline = "CLSI"))
options(old_opts)
# guideline = NULL or FALSE keeps S, I, and R separate
expect_equal(
example_isolates %>% select(AMX) %>% count_df(combine_SI = FALSE) %>% pull(value),
example_isolates %>% select(AMX) %>% count_df(guideline = NULL) %>% pull(value),
c(
suppressWarnings(example_isolates$AMX %>% count_S()),
example_isolates$AMX %>% count_I(),
example_isolates$AMX %>% count_R()
)
)
expect_identical(count_df(example_isolates[, "AMX"], guideline = FALSE), count_df(example_isolates[, "AMX"], guideline = NULL))
expect_error(count_df(example_isolates[, "AMX"], guideline = "WHO"))
expect_error(count_susceptible(example_isolates$AMX, guideline = NULL))
# the deprecated combine_SI must be followed literally if set, regardless of the guideline
expect_identical(
suppressWarnings(count_df(example_isolates[, "AMX"], combine_SI = TRUE, guideline = "CLSI")),
count_df(example_isolates[, "AMX"], guideline = "EUCAST")
)
expect_identical(
suppressWarnings(count_df(example_isolates[, "AMX"], combine_SI = FALSE, guideline = "CLSI")),
count_df(example_isolates[, "AMX"], guideline = NULL)
)
# grouping in sir_calc_df() (= backbone of sir_df())
expect_true("ward" %in% (example_isolates %>%