Check USA names
checkNamesUS.Rd
Check the differences between the names given in input and the names, as provided by United States Census of Bureau, of the corresponding USA statistical unit.
Arguments
- id
character vector with names
- unit
the type of USA statistical unit to check
- year
year of the analysis
- matchWith
the type of id to check if
unit
is set to "states"- scale
the scale of the map
- return_logical
a logical value indicating whether nomatched id are returned.
a logical value indicating whether print the nomatched names
- use_internet
a logical value indicating wheter the coordinates are downloaded from https://github.com/mappinguniverse/geospatial. If
FALSE
the maps downloaded during package installation will be used.
Details
The function provides a check between id names in the dataset and the USA unit. unit
starts from the largest aggregate, "country", to the smallest, "district". Since unit can change over the years, the year of the data has to be provided.
The single state can be coded in different ways, with names, id or number.
Value
Returns a string vector with nomatched names or a boolean vector indicating whether or not the id matched.
Examples
data("popUS")
ck <- checkNamesUS(popUS$id, unit = "state")
#> Warning: No match found for variables: puerto rico