(v1.4.0.9021) more robust class setting

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2020-11-16 16:57:55 +01:00
1 parent 05fb213a7c
commit deefce9520
29 files changed
+98 -85

No files matched your search

+4 -4
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