mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 09:11:51 +02:00
more unit tests
This commit is contained in:
2
R/mo.R
2
R/mo.R
@ -182,7 +182,7 @@ exec_as.mo <- function(x, Becker = FALSE, Lancefield = FALSE, allow_uncertain =
|
||||
# defined df to check for
|
||||
if (!is.null(reference_df)) {
|
||||
if (!is.data.frame(reference_df) | NCOL(reference_df) < 2) {
|
||||
stop('`reference_df` must be a data.frame with at least two columns.')
|
||||
stop('`reference_df` must be a data.frame with at least two columns.', call. = FALSE)
|
||||
}
|
||||
# remove factors, just keep characters
|
||||
suppressWarnings(
|
||||
|
@ -231,16 +231,7 @@ mo_property <- function(x, property = 'fullname', language = NULL, ...) {
|
||||
stop("invalid property: '", property, "' - use a column name of the `microorganisms` data set")
|
||||
}
|
||||
|
||||
# this will give a warning if x cannot be coerced
|
||||
res <- exec_as.mo(x = x, Becker = Becker, Lancefield = Lancefield, property = property)
|
||||
|
||||
if (property != "tsn") {
|
||||
res[x %in% c("", NA) | res %in% c("", NA, "(no MO)")] <- ""
|
||||
if (property %in% c("fullname", "shortname", "genus", "species", "subspecies", "type", "gramstain")) {
|
||||
res <- mo_translate(res, language = language)
|
||||
}
|
||||
}
|
||||
res
|
||||
mo_translate(mo_validate(x = x, property = property, ...), language = language)
|
||||
}
|
||||
|
||||
#' @rdname mo_property
|
||||
|
Reference in New Issue
Block a user