diff --git a/DESCRIPTION b/DESCRIPTION index 3b9a92a4..a8e4f70f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.2.9020 -Date: 2022-10-18 +Version: 1.8.2.9021 +Date: 2022-10-19 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index c55f1685..b870a4ff 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9020 +# AMR 1.8.2.9021 This version will eventually become v2.0! We're happy to reach a new major milestone soon! diff --git a/R/mo.R b/R/mo.R index 96735673..7d7646d0 100755 --- a/R/mo.R +++ b/R/mo.R @@ -440,7 +440,7 @@ as.mo <- function(x, # All unknowns ---- out[is.na(out) & !is.na(x)] <- "UNKNOWN" - AMR_env$mo_failures <- unique(x[out == "UNKNOWN" & x != "UNKNOWN" & !is.na(x)]) + AMR_env$mo_failures <- unique(x[out == "UNKNOWN" & !x %in% c("UNKNOWN", "con") & !x %like_case% "^[(]unknown [a-z]+[)]$" & !is.na(x)]) if (length(AMR_env$mo_failures) > 0) { warning_("The following input could not be coerced and was returned as \"UNKNOWN\": ", vector_and(AMR_env$mo_failures, quotes = TRUE), ".\nYou can retrieve this list with `mo_failures()`.") } diff --git a/inst/tinytest/test-ab.R b/inst/tinytest/test-ab.R index e755012a..8181f8f2 100755 --- a/inst/tinytest/test-ab.R +++ b/inst/tinytest/test-ab.R @@ -51,7 +51,6 @@ expect_stdout(print(data.frame(a = as.ab("amox")))) expect_warning(as.ab("J00AA00")) # ATC not yet available in data set expect_warning(as.ab("UNKNOWN")) -expect_warning(as.ab("")) expect_stdout(print(as.ab("amox"))) @@ -75,7 +74,7 @@ expect_equal( c("MEM", "AMC") ) -expect_message(as.ab("cipro mero")) +expect_warning(as.ab("cipro mero")) # based on Levenshtein distance expect_identical(ab_name("ceftazidim/avibactam", language = NULL), "Ceftazidime/avibactam") @@ -86,6 +85,7 @@ expect_inherits(x[1], "ab") expect_inherits(x[[1]], "ab") expect_inherits(c(x[1], x[9]), "ab") expect_inherits(unique(x[1], x[9]), "ab") +expect_inherits(rep(x[1], x[9]), "ab") expect_warning(x[1] <- "invalid code") expect_warning(x[[1]] <- "invalid code") expect_warning(c(x[1], "test")) diff --git a/inst/tinytest/test-mo.R b/inst/tinytest/test-mo.R index 1a76745c..4a3b2f1f 100644 --- a/inst/tinytest/test-mo.R +++ b/inst/tinytest/test-mo.R @@ -283,7 +283,7 @@ expect_equal( ) # no viruses -expect_equal(as.mo("Virus"), as.mo("UNKNOWN")) +expect_equal(suppressWarnings(as.mo("Virus")), as.mo("UNKNOWN")) # summary expect_equal(length(summary(example_isolates$mo)), 6)