AMR/man/ab_property.Rd

178 lines
6.4 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ab_property.R
\name{ab_property}
\alias{ab_property}
\alias{ab_name}
\alias{ab_cid}
\alias{ab_synonyms}
\alias{ab_tradenames}
\alias{ab_group}
\alias{ab_atc}
\alias{ATC}
\alias{ab_atc_group1}
\alias{ab_atc_group2}
\alias{ab_loinc}
\alias{ab_ddd}
\alias{ab_ddd_units}
\alias{ab_info}
\alias{ab_url}
\alias{set_ab_names}
\title{Get Properties of an Antibiotic}
\usage{
ab_name(x, language = get_AMR_locale(), tolower = FALSE, ...)
ab_cid(x, ...)
ab_synonyms(x, ...)
ab_tradenames(x, ...)
ab_group(x, language = get_AMR_locale(), ...)
ab_atc(x, only_first = FALSE, ...)
ab_atc_group1(x, language = get_AMR_locale(), ...)
ab_atc_group2(x, language = get_AMR_locale(), ...)
ab_loinc(x, ...)
ab_ddd(x, administration = "oral", ...)
ab_ddd_units(x, administration = "oral", ...)
ab_info(x, language = get_AMR_locale(), ...)
ab_url(x, open = FALSE, ...)
ab_property(x, property = "name", language = get_AMR_locale(), ...)
set_ab_names(
data,
...,
property = "name",
language = get_AMR_locale(),
snake_case = NULL
)
}
\arguments{
\item{x}{any (vector of) text that can be coerced to a valid antibiotic drug code with \code{\link[=as.ab]{as.ab()}}}
\item{language}{language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the \link[=AMR-options]{package option} \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
\item{tolower}{a \link{logical} to indicate whether the first \link{character} of every output should be transformed to a lower case \link{character}. This will lead to e.g. "polymyxin B" and not "polymyxin b".}
\item{...}{in case of \code{\link[=set_ab_names]{set_ab_names()}} and \code{data} is a \link{data.frame}: columns to select (supports tidy selection such as \code{column1:column4}), otherwise other arguments passed on to \code{\link[=as.ab]{as.ab()}}}
\item{only_first}{a \link{logical} to indicate whether only the first ATC code must be returned, with giving preference to J0-codes (i.e., the antimicrobial drug group)}
\item{administration}{way of administration, either \code{"oral"} or \code{"iv"}}
\item{open}{browse the URL using \code{\link[utils:browseURL]{utils::browseURL()}}}
\item{property}{one of the column names of one of the \link{antibiotics} data set: \code{vector_or(colnames(antibiotics), sort = FALSE)}.}
\item{data}{a \link{data.frame} of which the columns need to be renamed, or a \link{character} vector of column names}
\item{snake_case}{a \link{logical} to indicate whether the names should be in so-called \href{https://en.wikipedia.org/wiki/Snake_case}{snake case}: in lower case and all spaces/slashes replaced with an underscore (\verb{_})}
}
\value{
\itemize{
\item An \link{integer} in case of \code{\link[=ab_cid]{ab_cid()}}
\item A named \link{list} in case of \code{\link[=ab_info]{ab_info()}} and multiple \code{\link[=ab_atc]{ab_atc()}}/\code{\link[=ab_synonyms]{ab_synonyms()}}/\code{\link[=ab_tradenames]{ab_tradenames()}}
\item A \link{double} in case of \code{\link[=ab_ddd]{ab_ddd()}}
\item A \link{data.frame} in case of \code{\link[=set_ab_names]{set_ab_names()}}
\item A \link{character} in all other cases
}
}
\description{
Use these functions to return a specific property of an antibiotic from the \link{antibiotics} data set. All input values will be evaluated internally with \code{\link[=as.ab]{as.ab()}}.
}
\details{
All output \link[=translate]{will be translated} where possible.
The function \code{\link[=ab_url]{ab_url()}} will return the direct URL to the official WHO website. A warning will be returned if the required ATC code is not available.
The function \code{\link[=set_ab_names]{set_ab_names()}} is a special column renaming function for \link{data.frame}s. It renames columns names that resemble antimicrobial drugs. It always makes sure that the new column names are unique. If \code{property = "atc"} is set, preference is given to ATC codes from the J-group.
}
\section{Source}{
World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
}
\section{Reference Data Publicly Available}{
All data sets in this \code{AMR} package (about microorganisms, antibiotics, SIR interpretation, EUCAST rules, etc.) are publicly and freely available for download in the following formats: R, MS Excel, Apache Feather, Apache Parquet, SPSS, SAS, and Stata. We also provide tab-separated plain text files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please visit \href{https://msberends.github.io/AMR/articles/datasets.html}{our website for the download links}. The actual files are of course available on \href{https://github.com/msberends/AMR/tree/main/data-raw}{our GitHub repository}.
}
\examples{
# all properties:
ab_name("AMX")
ab_atc("AMX")
ab_cid("AMX")
ab_synonyms("AMX")
ab_tradenames("AMX")
ab_group("AMX")
ab_atc_group1("AMX")
ab_atc_group2("AMX")
ab_url("AMX")
# smart lowercase transformation
ab_name(x = c("AMC", "PLB"))
ab_name(x = c("AMC", "PLB"), tolower = TRUE)
# defined daily doses (DDD)
ab_ddd("AMX", "oral")
ab_ddd_units("AMX", "oral")
ab_ddd("AMX", "iv")
ab_ddd_units("AMX", "iv")
ab_info("AMX") # all properties as a list
# all ab_* functions use as.ab() internally, so you can go from 'any' to 'any':
ab_atc("AMP")
ab_group("J01CA01")
ab_loinc("ampicillin")
ab_name("21066-6")
ab_name(6249)
ab_name("J01CA01")
# spelling from different languages and dyslexia are no problem
ab_atc("ceftriaxon")
ab_atc("cephtriaxone")
ab_atc("cephthriaxone")
ab_atc("seephthriaaksone")
# use set_ab_names() for renaming columns
colnames(example_isolates)
colnames(set_ab_names(example_isolates))
colnames(set_ab_names(example_isolates, NIT:VAN))
\donttest{
if (require("dplyr")) {
example_isolates \%>\%
set_ab_names()
# this does the same:
example_isolates \%>\%
rename_with(set_ab_names)
# set_ab_names() works with any AB property:
example_isolates \%>\%
set_ab_names(property = "atc")
example_isolates \%>\%
set_ab_names(where(is.sir)) \%>\%
colnames()
example_isolates \%>\%
set_ab_names(NIT:VAN) \%>\%
colnames()
}
}
}
\seealso{
\link{antibiotics}
}