1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 04:02:19 +02:00

(v1.4.0.9021) more robust class setting

This commit is contained in:
2020-11-16 16:57:55 +01:00
parent 05fb213a7c
commit deefce9520
29 changed files with 98 additions and 85 deletions

8
R/ab.R
View File

@ -97,8 +97,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
if (all(toupper(x) %in% antibiotics$ab)) {
# valid AB code, but not yet right class
return(structure(.Data = toupper(x),
class = c("ab", "character")))
return(set_clean_class(toupper(x),
new_class = c("ab", "character")))
}
x_bak <- x
@ -455,8 +455,8 @@ as.ab <- function(x, flag_multiple_results = TRUE, info = TRUE, ...) {
x_result <- NA_character_
}
structure(.Data = x_result,
class = c("ab", "character"))
set_clean_class(x_result,
new_class = c("ab", "character"))
}
#' @rdname as.ab