Use these functions to return a specific property of an antibiotic from the antibiotics data set. All input values will be evaluated internally with as.ab()
.
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
- x
any (vector of) text that can be coerced to a valid antibiotic code with
as.ab()
- language
language of the returned text, defaults to system language (see
get_AMR_locale()
) and can also be set withgetOption("AMR_locale")
. Uselanguage = NULL
orlanguage = ""
to prevent translation.- tolower
a logical to indicate whether the first character of every output should be transformed to a lower case character. This will lead to e.g. "polymyxin B" and not "polymyxin b".
- ...
in case of
set_ab_names()
anddata
is a data.frame: variables to select (supports tidy selection such ascolumn1:column4
), otherwise other arguments passed on toas.ab()
- only_first
a logical to indicate whether only the first ATC code must be returned, with giving preference to J0-codes (i.e., the antimicrobial drug group)
- administration
way of administration, either
"oral"
or"iv"
- open
browse the URL using
utils::browseURL()
- property
one of the column names of one of the antibiotics data set:
vector_or(colnames(antibiotics), sort = FALSE)
.- data
a data.frame of which the columns need to be renamed, or a character vector of column names
- snake_case
a logical to indicate whether the names should be in so-called snake case: in lower case and all spaces/slashes replaced with an underscore (
_
)
Value
An integer in case of
ab_cid()
A named list in case of
ab_info()
and multipleab_atc()
/ab_synonyms()
/ab_tradenames()
A double in case of
ab_ddd()
A data.frame in case of
set_ab_names()
A character in all other cases
Details
All output will be translated where possible.
The function 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 set_ab_names()
is a special column renaming function for data.frames. It renames columns names that resemble antimicrobial drugs. It always makes sure that the new column names are unique. If property = "atc"
is set, preference is given to ATC codes from the J-group.
Source
World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: https://www.whocc.no/atc_ddd_index/
European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: https://ec.europa.eu/health/documents/community-register/html/reg_hum_atc.htm
Reference Data Publicly Available
All reference data sets (about microorganisms, antibiotics, R/SI interpretation, EUCAST rules, etc.) in this 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 all download links on our website, which is automatically updated with every code change.
Examples
# all properties:
ab_name("AMX") # "Amoxicillin"
#> [1] "Amoxicillin"
ab_atc("AMX") # "J01CA04" (ATC code from the WHO)
#> [1] "J01CA04"
ab_cid("AMX") # 33613 (Compound ID from PubChem)
#> [1] 33613
ab_synonyms("AMX") # a list with brand names of amoxicillin
#> [1] "actimoxi" "amoclen" "amolin"
#> [4] "amopen" "amopenixin" "amoxibiotic"
#> [7] "amoxicaps" "amoxicilina" "amoxicillin"
#> [10] "amoxicilline" "amoxicillinum" "amoxiden"
#> [13] "amoxil" "amoxivet" "amoxy"
#> [16] "amoxycillin" "anemolin" "aspenil"
#> [19] "biomox" "bristamox" "cemoxin"
#> [22] "clamoxyl" "delacillin" "dispermox"
#> [25] "efpenix" "flemoxin" "hiconcil"
#> [28] "histocillin" "hydroxyampicillin" "ibiamox"
#> [31] "imacillin" "lamoxy" "metafarma capsules"
#> [34] "metifarma capsules" "moxacin" "moxatag"
#> [37] "ospamox" "pamoxicillin" "piramox"
#> [40] "robamox" "sawamox pm" "tolodina"
#> [43] "unicillin" "utimox" "vetramox"
ab_tradenames("AMX") # same
#> [1] "actimoxi" "amoclen" "amolin"
#> [4] "amopen" "amopenixin" "amoxibiotic"
#> [7] "amoxicaps" "amoxicilina" "amoxicillin"
#> [10] "amoxicilline" "amoxicillinum" "amoxiden"
#> [13] "amoxil" "amoxivet" "amoxy"
#> [16] "amoxycillin" "anemolin" "aspenil"
#> [19] "biomox" "bristamox" "cemoxin"
#> [22] "clamoxyl" "delacillin" "dispermox"
#> [25] "efpenix" "flemoxin" "hiconcil"
#> [28] "histocillin" "hydroxyampicillin" "ibiamox"
#> [31] "imacillin" "lamoxy" "metafarma capsules"
#> [34] "metifarma capsules" "moxacin" "moxatag"
#> [37] "ospamox" "pamoxicillin" "piramox"
#> [40] "robamox" "sawamox pm" "tolodina"
#> [43] "unicillin" "utimox" "vetramox"
ab_group("AMX") # "Beta-lactams/penicillins"
#> [1] "Beta-lactams/penicillins"
ab_atc_group1("AMX") # "Beta-lactam antibacterials, penicillins"
#> [1] "Beta-lactam antibacterials, penicillins"
ab_atc_group2("AMX") # "Penicillins with extended spectrum"
#> [1] "Penicillins with extended spectrum"
ab_url("AMX") # link to the official WHO page
#> Amoxicillin
#> "https://www.whocc.no/atc_ddd_index/?code=J01CA04&showdescription=no"
# smart lowercase tranformation
ab_name(x = c("AMC", "PLB")) # "Amoxicillin/clavulanic acid" "Polymyxin B"
#> [1] "Amoxicillin/clavulanic acid" "Polymyxin B"
ab_name(x = c("AMC", "PLB"),
tolower = TRUE) # "amoxicillin/clavulanic acid" "polymyxin B"
#> [1] "amoxicillin/clavulanic acid" "polymyxin B"
# defined daily doses (DDD)
ab_ddd("AMX", "oral") # 1.5
#> [1] 1.5
ab_ddd_units("AMX", "oral") # "g"
#> [1] "g"
ab_ddd("AMX", "iv") # 3
#> [1] 3
ab_ddd_units("AMX", "iv") # "g"
#> [1] "g"
ab_info("AMX") # all properties as a list
#> $ab
#> [1] "AMX"
#>
#> $cid
#> [1] 33613
#>
#> $name
#> [1] "Amoxicillin"
#>
#> $group
#> [1] "Beta-lactams/penicillins"
#>
#> $atc
#> [1] "J01CA04"
#>
#> $atc_group1
#> [1] "Beta-lactam antibacterials, penicillins"
#>
#> $atc_group2
#> [1] "Penicillins with extended spectrum"
#>
#> $tradenames
#> [1] "actimoxi" "amoclen" "amolin"
#> [4] "amopen" "amopenixin" "amoxibiotic"
#> [7] "amoxicaps" "amoxicilina" "amoxicillin"
#> [10] "amoxicilline" "amoxicillinum" "amoxiden"
#> [13] "amoxil" "amoxivet" "amoxy"
#> [16] "amoxycillin" "anemolin" "aspenil"
#> [19] "biomox" "bristamox" "cemoxin"
#> [22] "clamoxyl" "delacillin" "dispermox"
#> [25] "efpenix" "flemoxin" "hiconcil"
#> [28] "histocillin" "hydroxyampicillin" "ibiamox"
#> [31] "imacillin" "lamoxy" "metafarma capsules"
#> [34] "metifarma capsules" "moxacin" "moxatag"
#> [37] "ospamox" "pamoxicillin" "piramox"
#> [40] "robamox" "sawamox pm" "tolodina"
#> [43] "unicillin" "utimox" "vetramox"
#>
#> $loinc
#> [1] "16365-9" "25274-2" "3344-9" "80133-2"
#>
#> $ddd
#> $ddd$oral
#> $ddd$oral$amount
#> [1] 1.5
#>
#> $ddd$oral$units
#> [1] "g"
#>
#>
#> $ddd$iv
#> $ddd$iv$amount
#> [1] 3
#>
#> $ddd$iv$units
#> [1] "g"
#>
#>
#>
# all ab_* functions use as.ab() internally, so you can go from 'any' to 'any':
ab_atc("AMP") # ATC code of AMP (ampicillin)
#> [1] "J01CA01" "S01AA19"
ab_group("J01CA01") # Drug group of ampicillins ATC code
#> [1] "Beta-lactams/penicillins"
ab_loinc("ampicillin") # LOINC codes of ampicillin
#> [1] "21066-6" "3355-5" "33562-0" "33919-2" "43883-8" "43884-6" "87604-5"
ab_name("21066-6") # "Ampicillin" (using LOINC)
#> [1] "Ampicillin"
ab_name(6249) # "Ampicillin" (using CID)
#> [1] "Ampicillin"
ab_name("J01CA01") # "Ampicillin" (using ATC)
#> [1] "Ampicillin"
# spelling from different languages and dyslexia are no problem
ab_atc("ceftriaxon")
#> [1] "J01DD04"
ab_atc("cephtriaxone")
#> [1] "J01DD04"
ab_atc("cephthriaxone")
#> [1] "J01DD04"
ab_atc("seephthriaaksone")
#> [1] "J01DD04"
# use set_ab_names() for renaming columns
colnames(example_isolates)
#> [1] "date" "hospital_id" "ward_icu" "ward_clinical"
#> [5] "ward_outpatient" "age" "gender" "patient_id"
#> [9] "mo" "PEN" "OXA" "FLC"
#> [13] "AMX" "AMC" "AMP" "TZP"
#> [17] "CZO" "FEP" "CXM" "FOX"
#> [21] "CTX" "CAZ" "CRO" "GEN"
#> [25] "TOB" "AMK" "KAN" "TMP"
#> [29] "SXT" "NIT" "FOS" "LNZ"
#> [33] "CIP" "MFX" "VAN" "TEC"
#> [37] "TCY" "TGC" "DOX" "ERY"
#> [41] "CLI" "AZM" "IPM" "MEM"
#> [45] "MTR" "CHL" "COL" "MUP"
#> [49] "RIF"
colnames(set_ab_names(example_isolates))
#> [1] "date" "hospital_id"
#> [3] "ward_icu" "ward_clinical"
#> [5] "ward_outpatient" "age"
#> [7] "gender" "patient_id"
#> [9] "mo" "benzylpenicillin"
#> [11] "oxacillin" "flucloxacillin"
#> [13] "amoxicillin" "amoxicillin_clavulanic_acid"
#> [15] "ampicillin" "piperacillin_tazobactam"
#> [17] "cefazolin" "cefepime"
#> [19] "cefuroxime" "cefoxitin"
#> [21] "cefotaxime" "ceftazidime"
#> [23] "ceftriaxone" "gentamicin"
#> [25] "tobramycin" "amikacin"
#> [27] "kanamycin" "trimethoprim"
#> [29] "trimethoprim_sulfamethoxazole" "nitrofurantoin"
#> [31] "fosfomycin" "linezolid"
#> [33] "ciprofloxacin" "moxifloxacin"
#> [35] "vancomycin" "teicoplanin"
#> [37] "tetracycline" "tigecycline"
#> [39] "doxycycline" "erythromycin"
#> [41] "clindamycin" "azithromycin"
#> [43] "imipenem" "meropenem"
#> [45] "metronidazole" "chloramphenicol"
#> [47] "colistin" "mupirocin"
#> [49] "rifampicin"
colnames(set_ab_names(example_isolates, NIT:VAN))
#> [1] "date" "hospital_id" "ward_icu" "ward_clinical"
#> [5] "ward_outpatient" "age" "gender" "patient_id"
#> [9] "mo" "PEN" "OXA" "FLC"
#> [13] "AMX" "AMC" "AMP" "TZP"
#> [17] "CZO" "FEP" "CXM" "FOX"
#> [21] "CTX" "CAZ" "CRO" "GEN"
#> [25] "TOB" "AMK" "KAN" "TMP"
#> [29] "SXT" "nitrofurantoin" "fosfomycin" "linezolid"
#> [33] "ciprofloxacin" "moxifloxacin" "vancomycin" "TEC"
#> [37] "TCY" "TGC" "DOX" "ERY"
#> [41] "CLI" "AZM" "IPM" "MEM"
#> [45] "MTR" "CHL" "COL" "MUP"
#> [49] "RIF"
# \donttest{
if (require("dplyr")) {
example_isolates %>%
set_ab_names() %>%
head()
# this does the same:
example_isolates %>%
rename_with(set_ab_names)%>%
head()
# set_ab_names() works with any AB property:
example_isolates %>%
set_ab_names(property = "atc")%>%
head()
example_isolates %>%
set_ab_names(where(is.rsi)) %>%
colnames()
example_isolates %>%
set_ab_names(NIT:VAN) %>%
colnames()
}
#> [1] "date" "hospital_id" "ward_icu" "ward_clinical"
#> [5] "ward_outpatient" "age" "gender" "patient_id"
#> [9] "mo" "PEN" "OXA" "FLC"
#> [13] "AMX" "AMC" "AMP" "TZP"
#> [17] "CZO" "FEP" "CXM" "FOX"
#> [21] "CTX" "CAZ" "CRO" "GEN"
#> [25] "TOB" "AMK" "KAN" "TMP"
#> [29] "SXT" "nitrofurantoin" "fosfomycin" "linezolid"
#> [33] "ciprofloxacin" "moxifloxacin" "vancomycin" "TEC"
#> [37] "TCY" "TGC" "DOX" "ERY"
#> [41] "CLI" "AZM" "IPM" "MEM"
#> [45] "MTR" "CHL" "COL" "MUP"
#> [49] "RIF"
# }