Skip to contents

Weights at the census block-level are used to spatially interpolate different geographies. Block-level total population, total number of homes, or total area from the 2020 Census can be chosen to use for the weights. All numeric variables in from are interpolated non-extensively, except for any numeric variables that start with n_, which are interpolated extensively.

Usage

interpolate(from, to, weights = c("pop", "homes", "area"))

Arguments

from

sf object with a neighborhood, census tract, census block group, census block, or zcta column and numeric values to be interpolated into target geographies. The from object should be CRS 5072. If not, it will be projected to 5072 for interpolation.

to

sf object of target geography This function is designed to work with cincy:: geography objects, and to objects must be CRS 5072.

weights

use one of "pop" (population), "homes", or "area" from the 2020 census block estimates to interpolate the values

Details

Possible geography id column names include "neighborhood", "zcta", "census_tract_id", "census_block_id", "census_block_group_id", and "district". Optionally, the column names can be appended with the census decade vintage "_2000", "_2010", or "_2000" ("district" vintages include "_2011" and "_2013").

Examples

# interpolate 2018 deprivation index to ZIP code level
interpolate(dep_index, cincy::zcta_tigris_2010, "pop")
#> Simple feature collection with 54 features and 8 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 953086.5 ymin: 1838813 xmax: 1003381 ymax: 1871411
#> Projected CRS: NAD83(NSRS2007) / Conus Albers
#> First 10 features:
#>    zcta_2010 fraction_assisted_income fraction_high_school_edu median_income
#> 1      45212               0.16410340                0.8421591      41301.12
#> 2      45204               0.40392778                0.7188268      25610.82
#> 3      45233               0.05260831                0.9309801      73058.66
#> 4      45216               0.27370364                0.7629741      33608.34
#> 5      45232               0.59374952                0.8475034      17231.43
#> 6      45251               0.14625964                0.8819390      57341.77
#> 7      45248               0.04986687                0.9435518      70346.04
#> 8      45215               0.15621395                0.8797299      58340.53
#> 9      45237               0.28496845                0.8737642      38110.11
#> 10     45240               0.14777140                0.9011510      52384.24
#>    fraction_no_health_ins fraction_poverty fraction_vacant_housing dep_index
#> 1              0.13237246       0.21703724              0.14662980 0.4261084
#> 2              0.18178607       0.42233918              0.25960964 0.6255437
#> 3              0.05037956       0.07854548              0.04275884 0.2599869
#> 4              0.16482487       0.24193363              0.16659043 0.5053800
#> 5              0.10067324       0.58286395              0.10035867 0.6427537
#> 6              0.11147235       0.11984921              0.07695121 0.3512824
#> 7              0.04933190       0.07368119              0.04908251 0.2578271
#> 8              0.09772376       0.15255358              0.10919115 0.3613932
#> 9              0.10532802       0.22753371              0.13103628 0.4436879
#> 10             0.10666545       0.15150728              0.08100371 0.3589110
#>                          geometry
#> 1  MULTIPOLYGON (((985627.9 18...
#> 2  MULTIPOLYGON (((977449.8 18...
#> 3  MULTIPOLYGON (((964705 1846...
#> 4  MULTIPOLYGON (((983383.8 18...
#> 5  MULTIPOLYGON (((980269.7 18...
#> 6  MULTIPOLYGON (((970338 1859...
#> 7  MULTIPOLYGON (((971363.6 18...
#> 8  MULTIPOLYGON (((983611.4 18...
#> 9  MULTIPOLYGON (((984422.3 18...
#> 10 MULTIPOLYGON (((976570.3 18...
# interpolate 2018 deprivation index to  2020 census tracts
interpolate(dep_index, cincy::tract_tigris_2020, "pop")
#> Simple feature collection with 226 features and 8 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 953086.5 ymin: 1838813 xmax: 1001262 ymax: 1869113
#> Projected CRS: NAD83(NSRS2007) / Conus Albers
#> First 10 features:
#>    census_tract_id_2020 fraction_assisted_income fraction_high_school_edu
#> 1           39061005200               0.04912664                0.9321523
#> 2           39061026200               0.37333333                0.6149897
#> 3           39061023901               0.05110274                0.9758308
#> 4           39061023701               0.07624633                0.8954626
#> 5           39061010500               0.21568627                0.8148148
#> 6           39061020501               0.05056760                0.9414548
#> 7           39061021900               0.39603960                0.8285410
#> 8           39061021102               0.04065400                0.9768626
#> 9           39061003700               0.54056518                0.7370618
#> 10          39061003800               0.42660550                0.7673716
#>    median_income fraction_no_health_ins fraction_poverty
#> 1          74211             0.09966121       0.09974641
#> 2          30455             0.16952381       0.31809524
#> 3          74275             0.04193055       0.05503385
#> 4          47708             0.06701031       0.08610495
#> 5          34083             0.09356725       0.32309942
#> 6          71385             0.11451342       0.07046980
#> 7          27670             0.13457077       0.37014471
#> 8          76875             0.02159624       0.03051643
#> 9           9669             0.13093196       0.68610635
#> 10         15745             0.11066844       0.45406125
#>    fraction_vacant_housing dep_index                       geometry
#> 1              0.107212476 0.2880370 MULTIPOLYGON (((987214 1851...
#> 2              0.075500770 0.5866909 MULTIPOLYGON (((955432.4 18...
#> 3              0.066298343 0.2394916 MULTIPOLYGON (((992289.3 18...
#> 4              0.053435115 0.3126355 MULTIPOLYGON (((989296.2 18...
#> 5              0.201991465 0.4767674 MULTIPOLYGON (((966164.1 18...
#> 6              0.050930460 0.2791648 MULTIPOLYGON (((962566.3 18...
#> 7              0.146959459 0.5463900 MULTIPOLYGON (((975331.7 18...
#> 8              0.005711775 0.2126445 MULTIPOLYGON (((966460.1 18...
#> 9              0.191002950 0.7171905 MULTIPOLYGON (((983456 1848...
#> 10             0.307936508 0.6186006 MULTIPOLYGON (((983764.7 18...