gchart_generate_us_areas {gchartsmap} | R Documentation |
Generate Google Charts spatial data for US areas
Description
This function queries 'Google Charts' resources to identify the US geographic areas used in services like Google Trends, and uses geographic data from the US Census Bureau to provide those areas with subdivisions at the county level.
Usage
gchart_generate_us_areas(areas = 1:1000L, limit = 1000)
Arguments
areas |
Area codes to get. Should be integers. |
limit |
Maximum number of areas to look for. |
Value
Returns a simple features 'data.frame' with class 'sf', representing the spatial data for all areas with a valid id between 1 and a 1000 from the Google Charts servers, using the WGS84 (epsg = 4326) coordinate reference system. You need to first run 'gchart_set_cache()' so the package knows where to store the downloaded data.
Examples
library(package = "gchartsmap")
# set the cache path to your system's cache path
gchartsmap::gchart_set_cache(path = tempdir())
# GET and process area 500
gchartsmap::gchart_generate_us_areas(500L)
# clean up
list.files(
tempdir(), all.files = TRUE, full.names = TRUE, recursive = TRUE
)
[Package gchartsmap version 1.0.1 Index]