diff --git a/DESCRIPTION b/DESCRIPTION index 0e511b56..54006011 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9060 -Date: 2019-08-25 +Version: 0.7.1.9061 +Date: 2019-08-26 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index a2d59f54..7a2c02fc 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9060 +# AMR 0.7.1.9061 ### Breaking * Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). The `freq()` function still works, since it is re-exported from the `clean` package to this `AMR` package. Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. Therefore, a new package was created for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too. diff --git a/R/mo_property.R b/R/mo_property.R index bd3e1d27..ed116d9b 100755 --- a/R/mo_property.R +++ b/R/mo_property.R @@ -144,7 +144,6 @@ mo_name <- function(x, language = get_locale(), ...) { mo_fullname <- mo_name #' @rdname mo_property -#' @importFrom dplyr %>% mutate pull #' @export mo_shortname <- function(x, language = get_locale(), ...) { x.mo <- AMR::as.mo(x, ...) @@ -416,13 +415,19 @@ mo_validate <- function(x, property, ...) { # so the 'call.' can be set to FALSE tryCatch(x[1L] %in% AMR::microorganisms[1, property], error = function(e) stop(e$message, call. = FALSE)) - - if (!all(x %in% pull(AMR::microorganisms, property)) - | Becker %in% c(TRUE, "all") - | Lancefield %in% c(TRUE, "all")) { + + if (is.mo(x) + & !Becker %in% c(TRUE, "all") + & !Lancefield %in% c(TRUE, "all")) { + # this will not reset mo_uncertainties and mo_failures + # because it's already a valid MO + x <- exec_as.mo(x, property = property, initial_search = FALSE, ...) + } else if (!all(x %in% pull(AMR::microorganisms, property)) + | Becker %in% c(TRUE, "all") + | Lancefield %in% c(TRUE, "all")) { x <- exec_as.mo(x, property = property, ...) } - + if (property == "mo") { return(to_class_mo(x)) } else if (property == "col_id") { diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 29e2d2e4..26409b80 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@
diff --git a/docs/articles/index.html b/docs/articles/index.html index e7e76955..24631ab7 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ diff --git a/docs/authors.html b/docs/authors.html index d9f466d5..f5b9f309 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ diff --git a/docs/index.html b/docs/index.html index 71ab45f1..87c88c4d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ diff --git a/docs/news/index.html b/docs/news/index.html index 8014e475..02f37f64 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ @@ -225,9 +225,9 @@ -as.mo(..., allow_uncertain = 3)
Contents