1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 05:26:13 +01:00
AMR/man/ab_property.Rd

194 lines
8.1 KiB
Plaintext
Raw Normal View History

2019-05-10 16:44:59 +02:00
% 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}
2021-08-17 14:34:11 +02:00
\alias{ab_atc}
2021-09-29 12:12:35 +02:00
\alias{ATC}
2019-05-10 16:44:59 +02:00
\alias{ab_atc_group1}
\alias{ab_atc_group2}
2020-01-26 20:20:00 +01:00
\alias{ab_loinc}
2019-05-10 16:44:59 +02:00
\alias{ab_ddd}
\alias{ab_ddd_units}
2019-05-16 22:07:31 +02:00
\alias{ab_info}
\alias{ab_url}
2021-09-29 12:12:35 +02:00
\alias{set_ab_names}
\title{Get Properties of an Antibiotic}
2019-05-10 16:44:59 +02:00
\usage{
ab_name(x, language = get_AMR_locale(), tolower = FALSE, ...)
2019-05-10 16:44:59 +02:00
ab_cid(x, ...)
ab_synonyms(x, ...)
ab_tradenames(x, ...)
ab_group(x, language = get_AMR_locale(), ...)
2019-05-10 16:44:59 +02:00
2021-08-17 14:34:11 +02:00
ab_atc(x, only_first = FALSE, ...)
ab_atc_group1(x, language = get_AMR_locale(), ...)
2019-05-10 16:44:59 +02:00
ab_atc_group2(x, language = get_AMR_locale(), ...)
2019-05-10 16:44:59 +02:00
2020-01-26 20:20:00 +01:00
ab_loinc(x, ...)
ab_ddd(x, administration = "oral", ...)
ab_ddd_units(x, administration = "oral", ...)
2019-05-10 16:44:59 +02:00
ab_info(x, language = get_AMR_locale(), ...)
2019-05-16 22:07:31 +02:00
ab_url(x, open = FALSE, ...)
ab_property(x, property = "name", language = get_AMR_locale(), ...)
2021-09-29 12:12:35 +02:00
set_ab_names(
data,
...,
2021-09-29 12:12:35 +02:00
property = "name",
language = get_AMR_locale(),
2021-09-29 12:12:35 +02:00
snake_case = NULL
)
2019-05-10 16:44:59 +02:00
}
\arguments{
2020-07-30 15:15:52 +02:00
\item{x}{any (vector of) text that can be coerced to a valid antibiotic code with \code{\link[=as.ab]{as.ab()}}}
2019-05-10 16:44:59 +02:00
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
2019-05-10 16:44:59 +02:00
2021-05-12 18:15:03 +02:00
\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".}
2019-05-10 16:44:59 +02:00
\item{...}{in case of \code{\link[=set_ab_names]{set_ab_names()}} and \code{data} is a \link{data.frame}: variables to select (supports tidy selection such as \code{column1:column4}), otherwise other arguments passed on to \code{\link[=as.ab]{as.ab()}}}
2019-05-10 16:44:59 +02:00
2021-08-17 14:34:11 +02:00
\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()}}}
2021-09-29 12:12:35 +02:00
\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{_})}
2019-05-10 16:44:59 +02:00
}
\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
2019-05-10 16:44:59 +02:00
}
}
\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()}}.
2019-05-10 16:44:59 +02:00
}
\details{
All output \link[=translate]{will be translated} where possible.
2020-05-25 01:01:14 +02:00
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.
2019-05-10 16:44:59 +02:00
}
\section{Stable Lifecycle}{
2020-05-25 01:01:14 +02:00
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
2020-07-08 14:48:06 +02:00
The \link[=lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
2020-05-25 01:01:14 +02:00
If the unlying code needs breaking changes, they will occur gradually. For example, an argument will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
}
2019-05-10 16:44:59 +02:00
\section{Source}{
World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: \url{https://www.whocc.no/atc_ddd_index/}
WHONET 2019 software: \url{http://www.whonet.org/software.html}
2021-05-24 15:29:17 +02:00
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm}
2019-05-10 16:44:59 +02:00
}
\section{Reference Data Publicly Available}{
2020-08-21 11:40:13 +02:00
All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this \code{AMR} package are publicly and freely available. We continually export our data sets to formats for use in R, SPSS, SAS, Stata and Excel. We also supply flat files that are machine-readable and suitable for input in any software program, such as laboratory information systems. Please find \href{https://msberends.github.io/AMR/articles/datasets.html}{all download links on our website}, which is automatically updated with every code change.
}
\section{Read more on Our Website!}{
2019-05-10 16:44:59 +02:00
2021-06-01 15:33:06 +02:00
On our website \url{https://msberends.github.io/AMR/} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR data analysis, the \href{https://msberends.github.io/AMR/reference/}{complete documentation of all functions} and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
2019-05-10 16:44:59 +02:00
}
\examples{
# all properties:
ab_name("AMX") # "Amoxicillin"
2021-08-17 14:34:11 +02:00
ab_atc("AMX") # "J01CA04" (ATC code from the WHO)
2019-05-10 16:44:59 +02:00
ab_cid("AMX") # 33613 (Compound ID from PubChem)
ab_synonyms("AMX") # a list with brand names of amoxicillin
ab_tradenames("AMX") # same
ab_group("AMX") # "Beta-lactams/penicillins"
ab_atc_group1("AMX") # "Beta-lactam antibacterials, penicillins"
ab_atc_group2("AMX") # "Penicillins with extended spectrum"
ab_url("AMX") # link to the official WHO page
2019-05-10 16:44:59 +02:00
2020-01-26 20:20:00 +01:00
# smart lowercase tranformation
2019-05-10 16:44:59 +02:00
ab_name(x = c("AMC", "PLB")) # "Amoxicillin/clavulanic acid" "Polymyxin B"
ab_name(x = c("AMC", "PLB"),
tolower = TRUE) # "amoxicillin/clavulanic acid" "polymyxin B"
2020-01-26 20:20:00 +01:00
# defined daily doses (DDD)
ab_ddd("AMX", "oral") # 1.5
ab_ddd_units("AMX", "oral") # "g"
ab_ddd("AMX", "iv") # 3
ab_ddd_units("AMX", "iv") # "g"
2019-05-10 16:44:59 +02:00
2019-05-16 21:20:00 +02:00
ab_info("AMX") # all properties as a list
2020-01-26 20:20:00 +01:00
# all ab_* functions use as.ab() internally, so you can go from 'any' to 'any':
ab_atc("AMP") # ATC code of AMP (ampicillin)
ab_group("J01CA01") # Drug group of ampicillins ATC code
ab_loinc("ampicillin") # LOINC codes of ampicillin
ab_name("21066-6") # "Ampicillin" (using LOINC)
ab_name(6249) # "Ampicillin" (using CID)
ab_name("J01CA01") # "Ampicillin" (using ATC)
# 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()
2021-09-29 12:12:35 +02:00
# this does the same:
example_isolates \%>\%
rename_with(set_ab_names)
# set_ab_names() works with any AB property:
example_isolates \%>\%
2021-12-05 23:21:59 +01:00
set_ab_names(property = "atc")
example_isolates \%>\%
set_ab_names(where(is.rsi)) \%>\%
colnames()
example_isolates \%>\%
set_ab_names(NIT:VAN) \%>\%
colnames()
}
}
2019-05-10 16:44:59 +02:00
}
\seealso{
\link{antibiotics}
2019-05-10 16:44:59 +02:00
}