Learn R Programming

mapping (version 1.4.1)

checkNamesUS: Check USA names

Description

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.

Usage

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)

Value

Returns a string vector with nomatched names or a boolean vector indicating whether or not the id matched.

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.

print

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.

See Also

checkNamesIT, checkNamesEU, checkNamesWR

Examples

Run this code
data("popUS")


ck <- checkNamesUS(popUS$id, unit = "state")

Run the code above in your browser using DataLab