standardName {mosaic} | R Documentation |
Standardization of Geographic Names
Description
Often different sources of geographical data will use different names for the same region. These utilities make it easier to merge data from different sources by converting names to standardized forms.
Usage
standardName(
x,
standard,
ignore.case = TRUE,
returnAlternatives = FALSE,
quiet = FALSE
)
standardCountry(
x,
ignore.case = TRUE,
returnAlternatives = FALSE,
quiet = FALSE
)
standardState(x, ignore.case = TRUE, returnAlternatives = FALSE, quiet = FALSE)
Arguments
x |
A vector with the region names to standardize |
standard |
a named vector providing the map from non-standard names (names of vector) to standard names (values of vector) |
ignore.case |
a logical indicating whether case should be ignored when matching. |
returnAlternatives |
a logical indicating whether all alternatives should be returned in addition to the standard name. |
quiet |
a logical indicating whether warnings should be suppressed |
Details
- standardName
This is the most general standardizing function. In addition to
x
, this function requires another argument:standard
- a named vector in which each name is a particular spelling of the region name in question and the corresponding value is the standardized version of that region name- standardCountry
This function will standardize the country names in
x
to the standard ISO_a3 country code format. IfreturnAlternatives
is set toTRUE
, this function will also return the the named vector used to standardize the country names- standardState
This function will standardize the US state names in
x
to the standard two-letter abbreviations. IfreturnAlternatives
is set toTRUE
, this function will also return the the named vector used to standardize the state names
In all three cases, any names not found in standard
will be left unaltered. Unless supressed, a warning message will
indicate the number of such cases, if there are any.