1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-10 07:41:57 +02:00

(v1.1.0.9016) small fix

This commit is contained in:
2020-05-21 12:28:57 +02:00
parent 743f9a5364
commit 1b1e243d14
18 changed files with 30 additions and 33 deletions

View File

@ -252,9 +252,9 @@ dataset_UTF8_to_ASCII <- function(df) {
}
# replace crayon::has_color
# replace crayon::has_color, but now also FALSE on non-interactive mode
has_colour <- function() {
if (Sys.getenv("TERM") == "dumb") {
if (Sys.getenv("TERM") == "dumb" | !interactive()) {
return(FALSE)
}
if (tolower(Sys.info()["sysname"]) == "windows") {

2
R/ab.R
View File

@ -215,6 +215,8 @@ as.ab <- function(x, ...) {
x_spelling <- gsub("(o\\+n|o\\+ne\\+)$", "o+ne*", x_spelling)
# replace multiple same characters to single one with '+', like "ll" -> "l+"
x_spelling <- gsub("(.)\\1+", "\\1+", x_spelling)
# replace spaces and slashes with a possibility on both
x_spelling <- gsub("[ /]", "( |/)", x_spelling)
# try if name starts with it
found <- antibiotics[which(antibiotics$name %like% paste0("^", x_spelling)), ]$ab

View File

@ -128,7 +128,7 @@ atc_online_property <- function(atc_code,
returnvalue <- rep(NA_character_, length(atc_code))
}
progress <- progress_estimated(n = length(atc_code))
progress <- progress_estimated(n = length(atc_code), 3)
on.exit(close(progress))
for (i in seq_len(length(atc_code))) {
@ -160,7 +160,7 @@ atc_online_property <- function(atc_code,
as.data.frame(stringsAsFactors = FALSE)
# case insensitive column names
colnames(tbl) <- tolower(colnames(tbl)) %>% gsub("^atc.*", "atc", .)
colnames(tbl) <- gsub("^atc.*", "atc", tolower(colnames(tbl)))
if (length(tbl) == 0) {
warning("ATC not found: ", atc_code[i], ". Please check ", atc_url, ".", call. = FALSE)

View File

@ -599,7 +599,7 @@ eucast_rules <- function(x,
}
}
if (!any(c("other", "all") %in% rules, na.rm = TRUE)) {
if (info == TRUE & !any(c("other", "all") %in% rules, na.rm = TRUE)) {
cat(font_red("\nSkipping inheritance rules defined by this package, such as setting trimethoprim (TMP) = R where trimethoprim/sulfamethoxazole (SXT) = R.\nUse eucast_rules(..., rules = \"all\") to also apply those rules.\n"))
}

Binary file not shown.