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

(v2.1.1.9253) parallel computing

This commit is contained in:
2025-04-26 15:47:00 +02:00
parent abee2a954e
commit 4e7fca3b38
13 changed files with 2311 additions and 44 deletions

View File

@ -573,6 +573,8 @@ antibiogram.default <- function(x,
for (ab in abx) {
# make sure they are SIR columns
x[, ab] <- as.sir(x[, ab, drop = TRUE])
# set NI as NA
x[[ab]][x[[ab]] == "NI"] <- NA_sir_
}
new_colname <- paste0(trimws(abx), collapse = sep)
if (length(abx) == 1) {
@ -584,7 +586,7 @@ antibiogram.default <- function(x,
} else {
S_values <- "S"
}
other_values <- setdiff(c("S", "SDD", "I", "R", "NI"), S_values)
other_values <- setdiff(c("S", "SDD", "I", "R"), S_values)
x_transposed <- as.list(as.data.frame(t(x[, abx, drop = FALSE]), stringsAsFactors = FALSE))
if (isTRUE(only_all_tested)) {
x[new_colname] <- as.sir(vapply(FUN.VALUE = character(1), x_transposed, function(x) ifelse(anyNA(x), NA_character_, ifelse(any(x %in% S_values), "S", "R")), USE.NAMES = FALSE))