mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 09:11:51 +02:00
(v0.7.1.9080) new LIS codes
This commit is contained in:
5
R/data.R
5
R/data.R
@ -55,7 +55,7 @@
|
||||
#'
|
||||
#' A data set containing the microbial taxonomy of six kingdoms from the Catalogue of Life. MO codes can be looked up using \code{\link{as.mo}}.
|
||||
#' @inheritSection catalogue_of_life Catalogue of Life
|
||||
#' @format A \code{\link{data.frame}} with 69,454 observations and 16 variables:
|
||||
#' @format A \code{\link{data.frame}} with 69,465 observations and 16 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{mo}}{ID of microorganism as used by this package}
|
||||
#' \item{\code{col_id}}{Catalogue of Life ID}
|
||||
@ -72,6 +72,7 @@
|
||||
#' \item{11 entries of \emph{Streptococcus} (beta-haemolytic: groups A, B, C, D, F, G, H, K and unspecified; other: viridans, milleri)}
|
||||
#' \item{2 entries of \emph{Staphylococcus} (coagulase-negative [CoNS] and coagulase-positive [CoPS])}
|
||||
#' \item{3 entries of \emph{Trichomonas} (\emph{Trichomonas vaginalis}, and its family and genus)}
|
||||
#' \item{1 entry of \emph{Blastocystis} (\emph{Blastocystis hominis}), although it officially does not exist (Noel et al. 2005, PMID 15634993)}
|
||||
#' \item{5 other 'undefined' entries (unknown, unknown Gram negatives, unknown Gram positives, unknown yeast and unknown fungus)}
|
||||
#' \item{9,460 species from the DSMZ (Deutsche Sammlung von Mikroorganismen und Zellkulturen) since the DSMZ contain the latest taxonomic information based on recent publications}
|
||||
#' }
|
||||
@ -114,7 +115,7 @@ catalogue_of_life <- list(
|
||||
#' Translation table for common microorganism codes
|
||||
#'
|
||||
#' A data set containing commonly used codes for microorganisms, from laboratory systems and WHONET. Define your own with \code{\link{set_mo_source}}.
|
||||
#' @format A \code{\link{data.frame}} with 4,927 observations and 2 variables:
|
||||
#' @format A \code{\link{data.frame}} with 5,006 observations and 2 variables:
|
||||
#' \describe{
|
||||
#' \item{\code{code}}{Commonly used code of a microorganism}
|
||||
#' \item{\code{mo}}{ID of the microorganism in the \code{\link{microorganisms}} data set}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#' @param ab_class an antimicrobial class, like \code{"carbapenems"}, as can be found in \code{AMR::antibiotics$group}
|
||||
#' @param result an antibiotic result: S, I or R (or a combination of more of them)
|
||||
#' @param scope the scope to check which variables to check, can be \code{"any"} (default) or \code{"all"}
|
||||
#' @param ... parameters passed on to \code{\link[dplyr]{filter_at}}
|
||||
#' @param ... parameters passed on to \code{filter_at} from the \code{dplyr} package
|
||||
#' @details The \code{group} column in \code{\link{antibiotics}} data set will be searched for \code{ab_class} (case-insensitive). If no results are found, the \code{atc_group1} and \code{atc_group2} columns will be searched. Next, \code{x} will be checked for column names with a value in any abbreviations, codes or official names found in the \code{antibiotics} data set.
|
||||
#' @rdname filter_ab_class
|
||||
#' @keywords filter fillter_class
|
||||
|
15
R/freq.R
15
R/freq.R
@ -29,22 +29,21 @@ clean::freq
|
||||
#' @export
|
||||
#' @noRd
|
||||
freq.mo <- function(x, ...) {
|
||||
x <- as.mo(x) # to get the newest mo codes
|
||||
x_noNA <- x[!is.na(x)]
|
||||
x_noNA <- as.mo(x[!is.na(x)]) # as.mo() to get the newest mo codes
|
||||
grams <- mo_gramstain(x_noNA, language = NULL)
|
||||
freq.default(x = x, ...,
|
||||
.add_header = list(`Gram-negative` = paste0(format(sum(grams == "Gram-negative", na.rm = TRUE),
|
||||
big.mark = ",",
|
||||
decimal.mark = "."),
|
||||
" (", percent(sum(grams == "Gram-negative", na.rm = TRUE) / length(grams), force_zero = TRUE),
|
||||
" of total)"),
|
||||
" (", percent(sum(grams == "Gram-negative", na.rm = TRUE) / length(grams), force_zero = TRUE, round = 2),
|
||||
")"),
|
||||
`Gram-positive` = paste0(format(sum(grams == "Gram-positive", na.rm = TRUE),
|
||||
big.mark = ",",
|
||||
decimal.mark = "."),
|
||||
" (", percent(sum(grams == "Gram-positive", na.rm = TRUE) / length(grams), force_zero = TRUE),
|
||||
" of total)"),
|
||||
genera = n_distinct(mo_genus(x_noNA, language = NULL)),
|
||||
species = n_distinct(paste(mo_genus(x_noNA, language = NULL),
|
||||
" (", percent(sum(grams == "Gram-positive", na.rm = TRUE) / length(grams), force_zero = TRUE, round = 2),
|
||||
")"),
|
||||
`Unique genera` = n_distinct(mo_genus(x_noNA, language = NULL)),
|
||||
`Unique species` = n_distinct(paste(mo_genus(x_noNA, language = NULL),
|
||||
mo_species(x_noNA, language = NULL)))))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user