1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 11:11:54 +02:00

(v1.4.0.9030) as.mo() fix for known lab codes

This commit is contained in:
2020-12-03 16:59:04 +01:00
parent 4c114ff4b4
commit e03b3c96d3
40 changed files with 136 additions and 124 deletions

View File

@ -383,9 +383,10 @@ mo_is_intrinsic_resistant <- function(x, ab, language = get_locale(), ...) {
ab <- rep(ab, length(x))
}
if (length(x) != length(ab)) {
stop_("length of 'x' and 'ab' must be equal, or one of them must be of length 1.")
stop_("length of `x` and `ab` must be equal, or one of them must be of length 1.")
}
# this saves about 50% in calculation time
intrinsic_to_check <- intrinsic_resistant[which(intrinsic_resistant$microorganism %in% x |
intrinsic_resistant$antibiotic %in% ab), , drop = FALSE]
paste(x, ab) %in% paste(intrinsic_to_check$microorganism, intrinsic_to_check$antibiotic)
@ -618,12 +619,12 @@ find_mo_col <- function(fn) {
mo <- suppressMessages(search_type_in_df(df, "mo"))
}, silent = TRUE)
if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
message_("Using column `", font_bold(mo), "` as input for ", fn, "()")
message_("Using column '", font_bold(mo), "' as input for ", fn, "()")
return(df[, mo, drop = TRUE])
} else {
stop_("Argument 'x' is missing and no column with info about microorganisms could be found.", call = -2)
stop_("Argument `x` is missing and no column with info about microorganisms could be found.", call = -2)
}
} else {
stop_("Argument 'x' is missing.", call = -2)
stop_("Argument `x` is missing.", call = -2)
}
}