Add neighborhood based on census tract
add_neighborhood.Rd
This function uses the internal data objects, hamilton_tract_to_cincy_neighborhood_2010
and
hamilton_tract_to_cincy_neighborhood_2020
, to add a neighborhood
from cincy::neigh_cchmc_2010
and cincy::neigh_cchmc_2020
for each
row of a data frame.
Usage
add_neighborhood(.x, vintage = c("2010", "2020"))
Arguments
- .x
a data frame containing a census tract column named
census_tract_id
,census_tract_id_2010
, orcensus_tract_id_2020
- vintage
a string specifying to use the
2010
or2020
census tract to neighborhood lookup table; if set will override any vintage found in census tract id column names
Details
The vintage of tracts is automatically inferred based on the
name of the found tract column (census_tract_id_2010
or census_tract_id_2020
), but
can be specified using the vintage argument. If just the column census_tract_id
exists, then a default of 2010 will be used.
Examples
add_neighborhood(tract_tigris_2010)
#> Simple feature collection with 222 features and 2 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 953086.5 ymin: 1838813 xmax: 1001233 ymax: 1869107
#> Projected CRS: NAD83(NSRS2007) / Conus Albers
#> First 10 features:
#> census_tract_id_2010 neighborhood geometry
#> 1 39061024800 Mariemont MULTIPOLYGON (((991875.4 18...
#> 2 39061024901 Anderson Twp.-Newtown MULTIPOLYGON (((995043.6 18...
#> 3 39061025002 Anderson Twp.-Newtown MULTIPOLYGON (((992320.4 18...
#> 4 39061025104 Anderson Twp.-Newtown MULTIPOLYGON (((994696.4 18...
#> 5 39061025102 Anderson Twp.-Newtown MULTIPOLYGON (((998985.4 18...
#> 6 39061024902 Anderson Twp.-Newtown MULTIPOLYGON (((997948.7 18...
#> 7 39061025101 Anderson Twp.-Newtown MULTIPOLYGON (((999147.2 18...
#> 8 39061025001 Anderson Twp.-Newtown MULTIPOLYGON (((995917.8 18...
#> 9 39061008601 N. Fairmount MULTIPOLYGON (((976656.2 18...
#> 10 39061008800 Westwood MULTIPOLYGON (((976754.2 18...