View source: R/utils_helpers.R
| admin_to_num | R Documentation |
This function converts administrative level names (e.g., "National", "Admin-1") into corresponding numerical values.
admin_to_num(admin_level)
admin_level |
A character string representing the administrative level. It can be "National" or "Admin-X" (where X is a positive integer). |
An integer representing the numerical level: - "National" is converted to 0. - "Admin-X" is converted to X as an integer. - Returns NULL if the input is invalid.
admin_to_num("National") # Returns 0
admin_to_num("Admin-1") # Returns 1
admin_to_num("Admin-2") # Returns 2
admin_to_num("Invalid") # Returns NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.