Get USA coordinates
loadCoordUS.RdLoads and returns names, ids, and coordinates for USA, to use with mapping functions and other "map" functions that accept an sf object.
Arguments
- unit
- type of USA unit to link 
- year
- year of the analysis 
- scale
- the scale of the map 
- unit_subset
- character vector of unit names to extract 
- matchWith
- the type of id 
- dir
- local directory in which shape files are stored 
- use_cache
- a logical value indicating whether to use the cache 
- use_internet
- a logical value indicating wheter the coordinates are downloaded from https://github.com/mappinguniverse/geospatial. If - FALSEthe maps downloaded during package installation will be used
- crs
- coordinate reference system. Look at - st_crs
Details
Coordinates are downloaded from the Github repo https://github.com/mappinguniverse/geospatial from US folder https://github.com/mappinguniverse/geospatial/tree/master/US.
If unit is not specified, borders of the USA countries are loaded.
Examples
US_coords = loadCoordUS(unit = "state")
str(US_coords)
#> Classes ‘sf’, ‘US’ and 'data.frame':	51 obs. of  6 variables:
#>  $ state_id    : chr  "MD" "IA" "DE" "OH" ...
#>  $ state       : chr  "Maryland" "Iowa" "Delaware" "Ohio" ...
#>  $ state_number: chr  "24" "19" "10" "39" ...
#>  $ region      : chr  "South" "Midwest" "South" "Midwest" ...
#>  $ division    : chr  "South Atlantic" "West North Central" "South Atlantic" "East North Central" ...
#>  $ geometry    :sfc_MULTIPOLYGON of length 51; first list element: List of 2
#>   ..$ :List of 1
#>   .. ..$ : num [1:261, 1:2] -79.5 -79.4 -79.4 -79.3 -79.3 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] -76 -76 -76 -76 -76 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#>  - attr(*, "sf_column")= chr "geometry"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA
#>   ..- attr(*, "names")= chr [1:5] "state_id" "state" "state_number" "region" ...
#>  - attr(*, "unit")= chr "state"
#>  - attr(*, "colID")= chr "state"
# \donttest{
coords_us<- loadCoordUS(unit = "state", unit_subset = c("Florida", "California"))
# }