(v3.0.1.9129) Add guideline argument to random_mic() and random_disk() so that values are based on one guideline version, make guideline years in examples, vignettes and website always the latest, and reword NEWS

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-13 21:43:19 +02:00
1 parent c8f6cea0a7
commit 9ebc33a59d
11 files changed
+55 -24

No files matched your search

+17
View File
@@ -41,4 +41,21 @@ test_that("test-random.R", {
expect_inherits(random_disk(100, mo = "Klebsiella pneumoniae", ab = "meropenem"), "disk")
expect_inherits(random_disk(100, ab = "meropenem"), "disk")
expect_inherits(random_sir(100), "sir")
# guideline: without a year the latest version is used, and the AMR_guideline option is the default
latest_clsi <- max(AMR::clinical_breakpoints$guideline[AMR::clinical_breakpoints$guideline %like% "CLSI"])
set.seed(1)
x1 <- random_disk(100, "Klebsiella pneumoniae", "ampicillin", guideline = "CLSI")
set.seed(1)
x2 <- random_disk(100, "Klebsiella pneumoniae", "ampicillin", guideline = latest_clsi)
old_opt <- options(AMR_guideline = "CLSI")
set.seed(1)
x3 <- random_disk(100, "Klebsiella pneumoniae", "ampicillin")
options(old_opt)
set.seed(1)
x4 <- random_disk(100, "Klebsiella pneumoniae", "ampicillin", guideline = "EUCAST")
expect_identical(x1, x2)
expect_identical(x1, x3)
expect_false(identical(x1, x4))
expect_error(random_mic(10, guideline = "EUCAST 1999"))
})