(v2.1.1.9286) deprecate antibiotics better, add ATC for ceftaroline

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2025-06-01 11:54:40 +02:00
1 parent 80f08f91da
commit e70f3de02e
17 files changed
+66 -23

No files matched your search

BIN
View File
Binary file not shown.
+38 -2
View File
@@ -36,9 +36,45 @@
NULL
#' @rdname AMR-deprecated
#' @usage NULL
#' @usage antibiotics
#' @export
"antibiotics"
antibiotics <- local({
warned <- FALSE
value <- AMR::antimicrobials
structure(
value,
class = c("deprecated_amr_dataset", class(value))
)
})
.amr_deprecation_warn <- function() {
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
invisible(NULL)
}
#' @export
`[.deprecated_amr_dataset` <- function(x, ...) {
.amr_deprecation_warn()
NextMethod("[")
}
#' @export
`[[.deprecated_amr_dataset` <- function(x, ...) {
.amr_deprecation_warn()
NextMethod("[[")
}
#' @export
`$.deprecated_amr_dataset` <- function(x, name) {
.amr_deprecation_warn()
NextMethod("$")
}
#' @export
print.deprecated_amr_dataset <- function(x, ...) {
.amr_deprecation_warn()
NextMethod("print")
}
#' @export
as.data.frame.deprecated_amr_dataset <- function(x, ...) {
.amr_deprecation_warn()
NextMethod("as.data.frame")
}
# REMEMBER to search for `deprecation_warning` in the package code to find all instances.
# currently deprecated arguments at least:
-8
View File
@@ -110,14 +110,6 @@ AMR_env$cross_icon <- if (isTRUE(base::l10n_info()$`UTF-8`)) "\u00d7" else "x"
AB_LOOKUP <- create_AB_AV_lookup(AMR::antimicrobials)
}
# deprecated antibiotics data set
makeActiveBinding("antibiotics", function() {
if (interactive()) {
deprecation_warning(old = "antibiotics", new = "antimicrobials", is_dataset = TRUE)
}
AMR::antimicrobials
}, env = asNamespace(pkgname))
AMR_env$AB_lookup <- cbind(AMR::antimicrobials, AB_LOOKUP)
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_LOOKUP)
}