1
0
mirror of https://github.com/msberends/AMR.git synced 2026-03-07 21:10:12 +01:00

(v3.0.1.9026) fix ab_group(NA)

This commit is contained in:
2026-03-06 12:41:27 +01:00
parent 4e3ea95fbd
commit 60e8f2bae6
8 changed files with 41 additions and 6 deletions

8
R/ab.R
View File

@@ -514,6 +514,14 @@ ab_reset_session <- function() {
}
}
#' @rdname as.ab
#' @details `NA_ab_` is a missing value of the new `ab` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_ab_ <- set_clean_class(NA_character_,
new_class = c("ab", "character")
)
# this prevents the requirement for putting the dependency in Imports:
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(pillar::pillar_shaft, ab)
pillar_shaft.ab <- function(x, ...) {

View File

@@ -172,6 +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)) {
if (is.null(grps[[i]]) || all(is.na(grps[[i]]))) {
grps[[i]] <- NA_character_
}
if (all_groups == FALSE) {
# take the first match based on ABX_PRIORITY_LIST
grps[[i]] <- grps[[i]][1]

8
R/mo.R
View File

@@ -623,6 +623,14 @@ mo_cleaning_regex <- function() {
)
}
#' @rdname as.mo
#' @details `NA_mo_` is a missing value of the new `mo` class, analogous to e.g. base \R's [`NA_character_`][base::NA].
#' @format NULL
#' @export
NA_mo_ <- set_clean_class(NA_character_,
new_class = c("mo", "character")
)
# UNDOCUMENTED METHODS ----------------------------------------------------
# this prevents the requirement for putting the dependency in Imports: