View source: R/location_functions.R
| tract_generator | R Documentation |
Pulls census tracts using tigris, computes tract centroids, and returns a three-column data.table with GEOID, latitude, and longitude.
tract_generator(st, county = NULL, use_cache = TRUE, ...)
st |
Character scalar; either a 2-digit state FIPS code (for example,
|
county |
A three-digit FIPS code (string) of the county or counties to subset on. This can also be a county name or vector of names. |
use_cache |
a boolean, defaults to TRUE, to set tigris option to use cache |
... |
arguments to be passed on to tigris::tracts() |
A data.table with columns:
11-digit tract GEOID (state(2) + county(3) + tract(6))
Centroid latitude in WGS84
Centroid longitude in WGS84
md_tracts <- tract_generator("24")
md_tracts2 <- tract_generator("MD")
howard_county_tracts <- tract_generator("MD", county = "027")
head(md_tracts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.