powered by
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, ...)
A data.table with columns:
data.table
11-digit tract GEOID (state(2) + county(3) + tract(6))
state(2) + county(3) + tract(6)
Centroid latitude in WGS84
Centroid longitude in WGS84
Character scalar; either a 2-digit state FIPS code (for example, "24") or a 2-letter USPS abbreviation (for example, "MD").
"24"
"MD"
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.
a boolean, defaults to TRUE, to set tigris option to use cache
arguments to be passed on to tigris::tracts()
md_tracts <- tract_generator("24") md_tracts2 <- tract_generator("MD") howard_county_tracts <- tract_generator("MD", county = "027") head(md_tracts)
Run the code above in your browser using DataLab