prepCountry | R Documentation |
Simple function to standardize the notation of country name (administrative level 0) by converting country codes to their long names and by removing special characters and some country name prepositions and separators.
prepCountry(x, to.lower = TRUE, special.char = FALSE, rm.abbrev = TRUE)
x |
a vector of country names to be standardized |
to.lower |
logical. Should the output names be return in lower cases? Default to TRUE. |
special.char |
logical. Should special characters be maintained? Default to FALSE. |
rm.abbrev |
logical. Should common name abbreviation be replaced? Default to TRUE. |
Country information is formatted into a standard notation, i.e. long
name format (in English). By default, all letters are lower-cased (argument
to.lower
) and special characters (argument special.char
) and common
abbreviations (e.g. 'st.') are removed (argument rm.abbrev
). These edits
aim at reducing possible variation in country name notation and facilitate
further data processing and comparison within the plantR workflow.
All country information with less than four letters are treated as country codes and they are converted to the long format. Currently, only the ISO 3166-1 alpha-2 and alpha-3 codes are considered for conversion to the long country name format.
The input vector x
in the standard name notation (see Details)
Renato A. F. de Lima
# Creating a data frame with locality information paises <- c("VC", "VCT", "St. Vincent and the Grenadines", "St. Vincent & Grenadines", "Saint-Martin", "Falkland Is.", NA) # Formating the locality information prepCountry(paises) prepCountry(paises, to.lower = FALSE) prepCountry(paises, rm.abbrev = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.