hcodes | R Documentation |
Create codes to identify each unique combination of hierarchical levels in a
reference dataset. Codes may be integer-based (function hcodes_int
) or
string-based (hcodes_str
). Integer-based codes reflect the alphabetical
ranking of each level within the next-highest level. They are constant-width
and may optionally be prefixed with any given string. String-based codes are
created by pasting together the values of each hierarchical level with a
given separator (with options for string standardization prior to
collapsing).
hcodes_str(ref, pattern, by, sep = "__", std_fn = string_std)
hcodes_int(ref, pattern, by, prefix = "")
ref |
|
pattern |
regex pattern to match the names of the hierarchical columns
in |
by |
vector giving the names of the hierarchical columns in |
sep |
(only for |
std_fn |
(only for |
prefix |
(only for |
A vector of codes
data(ne_ref)
# string-based codes
hcodes_str(ne_ref, pattern = "^adm")
# integer-based codes
hcodes_int(ne_ref, pattern = "^adm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.