abname.Rd
Convert antibiotic codes to a (trivial) antibiotic name or ATC code, or vice versa. This uses the data from antibiotics
.
abname(abcode, from = c("guess", "atc", "certe", "umcg"), to = "official", textbetween = " + ", tolower = FALSE)
abcode | a code or name, like |
---|---|
from, to | type to transform from and to. See |
textbetween | text to put between multiple returned texts |
tolower | return output as lower case with function |
The ab_property
functions are faster and more concise, but do not support concatenated strings, like abname("AMCL+GENT"
.
abname("AMCL")#> [1] "Amoxicillin and beta-lactamase inhibitor"# "Amoxicillin and beta-lactamase inhibitor" # It is quite flexible at default (having `from = "guess"`) abname(c("amox", "J01CA04", "Trimox", "dispermox", "Amoxil"))#> [1] "Amoxicillin" "Amoxicillin" "Amoxicillin" "Amoxicillin" "Amoxicillin"# "Amoxicillin" "Amoxicillin" "Amoxicillin" "Amoxicillin" "Amoxicillin" # Multiple antibiotics can be combined with "+". # The second antibiotic will be set to lower case when `tolower` was not set: abname("AMCL+GENT", textbetween = "/")#> [1] "Amoxicillin and beta-lactamase inhibitor/gentamicin"#> [1] "Amoxicillin and beta-lactamase inhibitor" #> [2] "Gentamicin"# "Amoxicillin and beta-lactamase inhibitor" "Gentamicin" abname("AMCL", to = "trivial_nl")#> [1] "Amoxicilline/clavulaanzuur"# "Amoxicilline/clavulaanzuur" abname("AMCL", to = "atc")#> [1] "J01CR02"# "J01CR02" # specific codes for University Medical Center Groningen (UMCG): abname("J01CR02", from = "atc", to = "umcg")#> [1] "AMCL"# "AMCL" # specific codes for Certe: abname("J01CR02", from = "atc", to = "certe")#> [1] "amcl"# "amcl"