mirror of
https://github.com/msberends/AMR.git
synced 2026-01-09 13:44:40 +01:00
(v3.0.1.9017) fix documentation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 3.0.1.9016
|
||||
Version: 3.0.1.9017
|
||||
Date: 2026-01-08
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
||||
2
NEWS.md
2
NEWS.md
@@ -1,4 +1,4 @@
|
||||
# AMR 3.0.1.9016
|
||||
# AMR 3.0.1.9017
|
||||
|
||||
### New
|
||||
* Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes`
|
||||
|
||||
@@ -163,6 +163,7 @@ ab_tradenames <- function(x, ...) {
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
#' @param all_groups A [logical] to indicate whether all antimicrobial groups must be return as a vector for each input value. For example, an antibiotic in the "aminopenicillins" group, is also in the "penicillins" and "beta-lactams" groups. Setting `all_groups = TRUE` would return all three for such an antibiotic, while `all_groups = FALSE` (default) only returns the most distinctive group name.
|
||||
#' @export
|
||||
ab_group <- function(x, language = get_AMR_locale(), all_groups = FALSE, ...) {
|
||||
meet_criteria(x, allow_NA = TRUE)
|
||||
@@ -171,11 +172,9 @@ ab_group <- function(x, language = get_AMR_locale(), all_groups = FALSE, ...) {
|
||||
|
||||
grps <- ab_validate(x = x, property = "group", ...)
|
||||
for (i in seq_along(grps)) {
|
||||
# take the first match based on ABX_PRIORITY_LIST
|
||||
if (all_groups == FALSE) {
|
||||
# take the first match based on ABX_PRIORITY_LIST
|
||||
grps[[i]] <- grps[[i]][1]
|
||||
} else if (length(grps[[i]]) > 1) {
|
||||
grps[[i]] <- grps[[i]][grps[[i]] != "Beta-lactamase inhibitors"] # leave these out if there are other groups
|
||||
}
|
||||
if (language != "en") {
|
||||
grps[[i]] <- translate_into_language(grps[[i]], language = language, only_affect_ab_names = TRUE)
|
||||
|
||||
@@ -59,6 +59,8 @@ set_ab_names(data, ..., property = "name", language = get_AMR_locale(),
|
||||
|
||||
\item{...}{In case of \code{\link[=set_ab_names]{set_ab_names()}} and \code{data} is a \link{data.frame}: columns to select (supports tidy selection such as \code{column1:column4}), otherwise other arguments passed on to \code{\link[=as.ab]{as.ab()}}.}
|
||||
|
||||
\item{all_groups}{A \link{logical} to indicate whether all antimicrobial groups must be return as a vector for each input value. For example, an antibiotic in the "aminopenicillins" group, is also in the "penicillins" and "beta-lactams" groups. Setting \code{all_groups = TRUE} would return all three for such an antibiotic, while \code{all_groups = FALSE} (default) only returns the most distinctive group name.}
|
||||
|
||||
\item{only_first}{A \link{logical} to indicate whether only the first ATC code must be returned, with giving preference to J0-codes (i.e., the antimicrobial drug group).}
|
||||
|
||||
\item{administration}{Way of administration, either \code{"oral"} or \code{"iv"}.}
|
||||
|
||||
@@ -40,6 +40,7 @@ test_that("test-ab_property.R", {
|
||||
expect_inherits(ab_tradenames(c("AMX", "AMX")), "list")
|
||||
|
||||
expect_identical(ab_group("AMX", language = NULL), "Aminopenicillins")
|
||||
expect_identical(ab_group("AMX", language = NULL, all_groups = TRUE), c("Aminopenicillins", "Penicillins", "Beta-lactams"))
|
||||
expect_identical(ab_atc_group1("AMX", language = NULL), "Beta-lactam antibacterials, penicillins")
|
||||
expect_identical(ab_atc_group2("AMX", language = NULL), "Penicillins with extended spectrum")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user