Include isolates of unknown species in grouped antibiograms and in wisca(), which were silently excluded with the warning 'invalid microorganism code, NA generated'

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2026-10-15 10:21:44 +02:00
1 parent 3a87075ad3
commit eb6d07e1fe
4 files changed
+28 -7

No files matched your search

+7 -1
View File
@@ -578,7 +578,13 @@ antibiogram.default <- function(x,
x$`.mo` <- mo_property(x$`.mo`, property = mo_transform, language = language)
}
}
x$`.mo`[x$`.mo` %in% c(NA, "UNKNOWN")] <- "(??)"
# keep unknown microorganisms, so that they are also included in grouped antibiograms and WISCA
if (is.mo(x$`.mo`)) {
# the 'mo' class only allows valid codes, of which "UNKNOWN" is one
x$`.mo`[is.na(x$`.mo`)] <- "UNKNOWN"
} else {
x$`.mo`[x$`.mo` %in% c(NA, "UNKNOWN")] <- "(??)"
}
# get antimicrobials
ab_trycatch <- tryCatch(colnames(suppressWarnings(x[, antimicrobials, drop = FALSE])), error = function(e) NULL)