mirror of
https://github.com/msberends/AMR.git
synced 2025-07-13 04:42:09 +02:00
styled, unit test fix
This commit is contained in:
@ -109,36 +109,38 @@ All data sets in this \code{AMR} package (about microorganisms, antibiotics, R/S
|
||||
|
||||
\examples{
|
||||
# all properties:
|
||||
ab_name("AMX") # "Amoxicillin"
|
||||
ab_atc("AMX") # "J01CA04" (ATC code from the WHO)
|
||||
ab_cid("AMX") # 33613 (Compound ID from PubChem)
|
||||
ab_synonyms("AMX") # a list with brand names of amoxicillin
|
||||
ab_name("AMX") # "Amoxicillin"
|
||||
ab_atc("AMX") # "J01CA04" (ATC code from the WHO)
|
||||
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_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
|
||||
ab_url("AMX") # link to the official WHO page
|
||||
|
||||
# smart lowercase tranformation
|
||||
ab_name(x = c("AMC", "PLB")) # "Amoxicillin/clavulanic acid" "Polymyxin B"
|
||||
ab_name(x = c("AMC", "PLB"),
|
||||
tolower = TRUE) # "amoxicillin/clavulanic acid" "polymyxin B"
|
||||
ab_name(x = c("AMC", "PLB")) # "Amoxicillin/clavulanic acid" "Polymyxin B"
|
||||
ab_name(
|
||||
x = c("AMC", "PLB"),
|
||||
tolower = TRUE
|
||||
) # "amoxicillin/clavulanic acid" "polymyxin B"
|
||||
|
||||
# defined daily doses (DDD)
|
||||
ab_ddd("AMX", "oral") # 1.5
|
||||
ab_ddd("AMX", "oral") # 1.5
|
||||
ab_ddd_units("AMX", "oral") # "g"
|
||||
ab_ddd("AMX", "iv") # 3
|
||||
ab_ddd_units("AMX", "iv") # "g"
|
||||
ab_ddd("AMX", "iv") # 3
|
||||
ab_ddd_units("AMX", "iv") # "g"
|
||||
|
||||
ab_info("AMX") # all properties as a list
|
||||
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") # 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)
|
||||
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")
|
||||
@ -155,24 +157,24 @@ if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
set_ab_names() \%>\%
|
||||
head()
|
||||
|
||||
|
||||
# this does the same:
|
||||
example_isolates \%>\%
|
||||
rename_with(set_ab_names)\%>\%
|
||||
rename_with(set_ab_names) \%>\%
|
||||
head()
|
||||
|
||||
|
||||
# set_ab_names() works with any AB property:
|
||||
example_isolates \%>\%
|
||||
set_ab_names(property = "atc")\%>\%
|
||||
set_ab_names(property = "atc") \%>\%
|
||||
head()
|
||||
|
||||
example_isolates \%>\%
|
||||
set_ab_names(where(is.rsi)) \%>\%
|
||||
colnames()
|
||||
|
||||
example_isolates \%>\%
|
||||
set_ab_names(NIT:VAN) \%>\%
|
||||
colnames()
|
||||
|
||||
example_isolates \%>\%
|
||||
set_ab_names(where(is.rsi)) \%>\%
|
||||
colnames()
|
||||
|
||||
example_isolates \%>\%
|
||||
set_ab_names(NIT:VAN) \%>\%
|
||||
colnames()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user