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.
checkNamesUS(id,
unit = c("country", "region", "division", "state",
"county", "district",
"district_county", "urban_area"),
year = c("2018"), matchWith = c("name", "id", "number"),
scale = c("20", "50", "500"), return_logical = FALSE,
print = TRUE, use_internet = TRUE)
Returns a string vector with nomatched names or a boolean vector indicating whether or not the id matched.
character vector with names
the type of USA statistical unit to check
year of the analysis
the type of id to check if unit
is set to "states"
the scale of the map
a logical value indicating whether nomatched id are returned.
a logical value indicating whether print the nomatched names
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.
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.
checkNamesIT
, checkNamesEU
, checkNamesWR
data("popUS")
ck <- checkNamesUS(popUS$id, unit = "state")
Run the code above in your browser using DataLab