mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 12:31:58 +02:00
163 new trade names, added ab_tradenames
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#' @param x a (vector of a) valid \code{\link{atc}} code or any text that can be coerced to a valid atc with \code{\link{as.atc}}
|
||||
#' @param property one of the column names of one of the \code{\link{antibiotics}} data set, like \code{"atc"} and \code{"official"}
|
||||
#' @rdname ab_property
|
||||
#' @return A vector of values. In case of \code{ab_tradenames}, if \code{x} is of length one, a vector will be returned. Otherwise a \code{\link{list}}, with \code{x} as names.
|
||||
#' @export
|
||||
#' @importFrom dplyr %>% left_join pull
|
||||
#' @seealso \code{\link{antibiotics}}
|
||||
@ -82,3 +83,16 @@ ab_certe <- function(x) {
|
||||
ab_umcg <- function(x) {
|
||||
ab_property(x, "umcg")
|
||||
}
|
||||
|
||||
#' @rdname ab_property
|
||||
#' @export
|
||||
ab_tradenames <- function(x) {
|
||||
res <- ab_property(x, "trade_name")
|
||||
res <- strsplit(res, "|", fixed = TRUE)
|
||||
if (length(x) == 1) {
|
||||
res <- unlist(res)
|
||||
} else {
|
||||
names(res) <- x
|
||||
}
|
||||
res
|
||||
}
|
||||
|
Reference in New Issue
Block a user