mirror of
https://github.com/msberends/AMR.git
synced 2025-09-15 15:09:41 +02:00
14
R/mo.R
14
R/mo.R
@@ -747,13 +747,17 @@ freq.mo <- function(x, ...) {
|
||||
# this prevents the requirement for putting the dependency in Imports:
|
||||
#' @rawNamespace if(getRversion() >= "3.0.0") S3method(skimr::get_skimmers, mo)
|
||||
get_skimmers.mo <- function(column) {
|
||||
mo <- as.mo(column, keep_synonyms = TRUE, language = NULL, info = FALSE)
|
||||
mo <- mo[!is.na(mo)]
|
||||
spp <- mo[mo_species(mo, keep_synonyms = TRUE, language = NULL, info = FALSE) != ""]
|
||||
skimr::sfl(
|
||||
skim_type = "mo",
|
||||
unique_total = ~ length(unique(stats::na.omit(.))),
|
||||
gram_negative = ~ sum(mo_is_gram_negative(.), na.rm = TRUE),
|
||||
gram_positive = ~ sum(mo_is_gram_positive(.), na.rm = TRUE),
|
||||
top_genus = ~ names(sort(-table(mo_genus(stats::na.omit(.), language = NULL))))[1L],
|
||||
top_species = ~ names(sort(-table(mo_name(stats::na.omit(.), language = NULL))))[1L]
|
||||
n_unique = ~ length(unique(mo)),
|
||||
gram_negative = ~ sum(mo_is_gram_negative(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
gram_positive = ~ sum(mo_is_gram_positive(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
yeast = ~ sum(mo_is_yeast(mo, keep_synonyms = TRUE, language = NULL, info = FALSE), na.rm = TRUE),
|
||||
top_genus = ~ names(sort(-table(mo_genus(mo, keep_synonyms = TRUE, language = NULL, info = FALSE))))[1L],
|
||||
top_species = ~ names(sort(-table(mo_name(spp, keep_synonyms = TRUE, language = NULL, info = FALSE))))[1L],
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user