atcLevel | R Documentation |
atcLevel
determines the ATC level for the
provided ATC code. Note that the level is purely determined by the
number of characters. The function does not evaluate whether the
provided key represents a valid ATC key/code.
See AtcDb
for an overview of the various levels.
toAtcLevel
transforms the provided ATC code(s) to a lower
level code. The function returns 'NA' for codes that have a lower
level than the level specified with parameter level
.
atcLevel(x) toAtcLevel(x, level = 1)
x |
For |
level |
|
For atcLevel
: an integer
of length 1 representing the
ATC level. The function returns NA
if the length of the ATC code
does not match any of the levels (i.e. the length of the code is not
equal to 1, 3, 4, 5 or 7).
toAtcLevel
: if length(level) == 1
: returns a
character
of the same length then x
. If
length(level) > 1
: returns a matrix
of ATC codes, each
column corresponding to elements in x
, each row to ATC levels.
Johannes Rainer
AtcDb
for a listing and description of ATC levels.
## Get the level for given ATC codes atcLevel(c("C07AB07", "A12AX")) ## Invalid ATC code atcLevel("AA") ## Transform an ATC code to a lower level. toAtcLevel("A01", level = 1) ## Transform one ATC code into two different levels toAtcLevel("A01CD04", level = c(1, 3)) ## Transform two codes. toAtcLevel(c("A01CD", "A01CD04"), level = 1) ## Transform two codes in 3 levels toAtcLevel(c("A01CD", "A01CD04"), level = c(1, 3, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.