According to (US Department of Housing and Urban Development, n.d.), the difficulty of linking United States Postal Service (USPS) ZIP codes to Census Bureau regions is one of the many obstacles that social science scholars and practitioners face. Only at the ZIP code level is there relevant data that, when paired with demographic data calculated at various Census geographic levels, could open up new paths of investigation.
Furthermore, the (US Department of Housing and Urban Development, n.d.) believes that while there are several appropriate approaches for integrating ZIP codes with Census geographies, they are limited. The HUD-USPS Crosswalk Files were supplied by PD&R to enable more routes for integrating these data. These one-of-a-kind files were created using data from the quarterly USPS Vacancy Data. They come straight from the USPS; they’re updated quarterly, so they’re always up to date with changes in ZIP code configurations; and they reflect both commercial and residential addresses. Because many of the phenomena that housing researchers study are based on housing unit or address, the latter attribute is of special interest to them. Analysts can take into account not just the spatial distribution of population, but also the spatial distribution of residences, by utilizing an allocation approach based on residential addresses rather than by area or population. This allows for a more sophisticated approach to data allocation across different geographies.
These journal articles describe the problem and proposed solution in more detail:
This chart provided by the US Census Bureau gives a good example of the relationships among different geographies. The crosswalk files only support a subset of these.
There are 12 main function calls for the crosswalk files: the package also contains an omni function which encapsulates the capabilities of all the main function calls below – omni-function
The first geoid type in the function call is what to query for. For example in 1) above, ‘zip’ is the first geoid and ‘tract’ is the second geoid.
The second geoid in the function call describes the geoid which we want to determine ‘intersection’ with the first geoid where intersection is described as the % of residential, business, other, and total buildings that overlap.
For example, in function call #7, we might have a county called 22031 which has zip codes 71052, 71078, 71049, 71032 … where the residential % (res_ratio) of each zip is 0.38, 0.21, 0.11, 0.05 … respectively. Of all these zipcodes’ res_ratios, when added up will equal 1, signaling these grouping of zip codes make up 100% of residential address in the county with each zipcode taking up their respective residential percentage.
Disclaimer: Although there exists inverse relationships in the Crosswalk Files, the measurements are NOT COMPLETELY inverse – for reasons stated within the papers above.
These are basic examples which shows you to query the Crosswalk API. Before looking at the outputted data I RECOMMEND first taking a look at the parameters as well as return data located at the bottom of the page.
library(rhud)
#>
#> rhud:
#> -------------------------------------------------------------------------------------
#> * To begin using this package, you must obtain a key from HUD User website.
#> * To enable caching of rhud data, use `options(rhud_use_cache = TRUE)`
#> * To get tibbles instead of dataframes, use `options(rhud_use_tibble = TRUE)`
#> * Set these in your R script for single session or in .Rprofile for persistence.
#> -------------------------------------------------------------------------------------
options (digits=4)
hud_cw_zip_tract(zip = '35213', year = c('2010'), quarter = c('1'))
#> Downloading: [==================================================] 100% 1/1
#>
#> tract res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 01073010801 0.338469 0.404558 0.697872 0.354414 35213 2010 1
#> 2 01073010803 0.230782 0.028490 0.008511 0.212530 35213 2010 1
#> 3 01073005600 0.185858 0.039886 0.004255 0.171949 35213 2010 1
#> 4 01073010802 0.114337 0.011396 0.000000 0.105006 35213 2010 1
#> 5 01073002306 0.061953 0.509971 0.144681 0.088122 35213 2010 1
#> 6 01073004702 0.037626 0.000000 0.144681 0.039396 35213 2010 1
#> 7 01073004800 0.018975 0.000000 0.000000 0.017328 35213 2010 1
#> 8 01073010805 0.009244 0.005698 0.000000 0.008738 35213 2010 1
#> 9 01073010804 0.002757 0.000000 0.000000 0.002518 35213 2010 1
hud_cw_zip_county(zip = 35213, year = c('2020'), quarter = c('2'))
#>
: [==================================================] 100% 1/1
Downloading#> county res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 01073 1 1 1 1 35213 2020 2
hud_cw_zip_cbsa(zip = 35213, year = c('2011'), quarter = c('3'))
#>
: [==================================================] 100% 1/1
Downloading#> cbsa res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 13820 1 1 1 1 35213 2011 3
hud_cw_zip_cbsadiv(zip = '22031', year = c('2019'), quarter = c('4'))
#>
: [==================================================] 100% 1/1
Downloading#> cbsadiv res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 47894 1 1 1 1 22031 2019 4
hud_cw_zip_cd(zip = '35213', year = c(2011), quarter = c(1))
#>
: [==================================================] 100% 1/1
Downloading#> cd res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 0106 0.952728 0.9831 0.991701 0.955706 35213 2011 1
#> 2 0107 0.043711 0.0169 0.008299 0.041045 35213 2011 1
#> 3 0103 0.001781 0.0000 0.000000 0.001624 35213 2011 1
#> 4 0104 0.001781 0.0000 0.000000 0.001624 35213 2011 1
hud_cw_tract_zip(tract = 48201223100, year = c('2017'), quarter = c('1'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio tract year quarter
#> 1 77032 1 0.95425 1 0.991617 48201223100 2017 1
#> 2 77396 0 0.04575 0 0.008383 48201223100 2017 1
hud_cw_county_zip(county = '22031', year = c('2010'), quarter = c('1'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio county year quarter
#> 1 71052 0.4322130 0.699634 0.56338 0.4455100 22031 2010 1
#> 2 71078 0.1816700 0.086081 0.15493 0.1770400 22031 2010 1
#> 3 71049 0.1103580 0.065934 0.15493 0.1085520 22031 2010 1
#> 4 71032 0.0813449 0.040293 0.01408 0.0790172 22031 2010 1
#> 5 71027 0.0699566 0.047619 0.04225 0.0687441 22031 2010 1
#> 6 71030 0.0435647 0.020147 0.04225 0.0424621 22031 2010 1
#> 7 71046 0.0425705 0.021978 0.01408 0.0414348 22031 2010 1
#> 8 71063 0.0275669 0.014652 0.01408 0.0268813 22031 2010 1
#> 9 71419 0.0105748 0.003663 0.00000 0.0101875 22031 2010 1
#> 10 71065 0.0001808 0.000000 0.00000 0.0001712 22031 2010 1
hud_cw_cbsa_zip(cbsa = '10140', year = c('2017'), quarter = c('2'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio cbsa year quarter
#> 1 98520 3.384e-01 0.5520178 0.4216084 3.573e-01 10140 2017 2
#> 2 98550 1.823e-01 0.1780822 0.2258327 1.835e-01 10140 2017 2
#> 3 98569 1.268e-01 0.0744169 0.1283509 1.230e-01 10140 2017 2
#> 4 98563 1.166e-01 0.0995927 0.1064175 1.150e-01 10140 2017 2
#> 5 98541 1.001e-01 0.0377638 0.0609261 9.411e-02 10140 2017 2
#> 6 98557 4.417e-02 0.0148093 0.0138099 4.093e-02 10140 2017 2
#> 7 98537 3.694e-02 0.0159200 0.0138099 3.457e-02 10140 2017 2
#> 8 98568 2.151e-02 0.0011107 0.0040617 1.938e-02 10140 2017 2
#> 9 98595 1.415e-02 0.0103665 0.0154346 1.391e-02 10140 2017 2
#> 10 98547 5.923e-03 0.0029619 0.0024370 5.581e-03 10140 2017 2
#> 11 98535 2.993e-03 0.0011107 0.0016247 2.805e-03 10140 2017 2
#> 12 98575 2.899e-03 0.0014809 0.0008123 2.721e-03 10140 2017 2
#> 13 98526 2.307e-03 0.0051833 0.0000000 2.444e-03 10140 2017 2
#> 14 98552 1.964e-03 0.0025916 0.0000000 1.944e-03 10140 2017 2
#> 15 98536 1.964e-03 0.0007405 0.0000000 1.805e-03 10140 2017 2
#> 16 98571 6.546e-04 0.0007405 0.0016247 6.942e-04 10140 2017 2
#> 17 98579 2.494e-04 0.0000000 0.0000000 2.221e-04 10140 2017 2
#> 18 98559 3.117e-05 0.0007405 0.0000000 8.331e-05 10140 2017 2
#> 19 98562 0.000e+00 0.0003702 0.0008123 5.554e-05 10140 2017 2
#> 20 98583 0.000e+00 0.0000000 0.0008123 2.777e-05 10140 2017 2
#> 21 98587 0.000e+00 0.0000000 0.0008123 2.777e-05 10140 2017 2
#> 22 98566 0.000e+00 0.0000000 0.0008123 2.777e-05 10140 2017 2
hud_cw_cbsadiv_zip(cbsadiv = 10380, year = c('2017'), quarter = c('4'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio cbsadiv year quarter
#> 1 00662 0.1640649 0.185800 0.147385 1.652e-01 10380 2017 4
#> 2 00603 0.1564245 0.142274 0.407290 1.582e-01 10380 2017 4
#> 3 00685 0.1352663 0.138602 0.076070 1.349e-01 10380 2017 4
#> 4 00602 0.1003411 0.102149 0.061807 1.000e-01 10380 2017 4
#> 5 00610 0.0840450 0.075490 0.037242 8.304e-02 10380 2017 4
#> 6 00641 0.0810440 0.090996 0.081616 8.166e-02 10380 2017 4
#> 7 00676 0.0817030 0.066785 0.045959 8.042e-02 10380 2017 4
#> 8 00669 0.0679181 0.054815 0.025357 6.668e-02 10380 2017 4
#> 9 00677 0.0574370 0.055359 0.102219 5.778e-02 10380 2017 4
#> 10 00605 0.0337231 0.048014 0.001585 3.426e-02 10380 2017 4
#> 11 00690 0.0264032 0.018906 0.007132 2.575e-02 10380 2017 4
#> 12 00604 0.0057615 0.017546 0.001585 6.434e-03 10380 2017 4
#> 13 00611 0.0056725 0.003128 0.001585 5.475e-03 10380 2017 4
#> 14 00612 0.0001959 0.000136 0.001585 2.068e-04 10380 2017 4
#> 15 00631 0.0000000 0.000000 0.001585 1.654e-05 10380 2017 4
hud_cw_cd_zip(cd = '2202', year = c('2010'), quarter = c('4'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio cd year quarter
#> 1 70072 0.0873171 6.011e-02 0.0383332 8.356e-02 2202 2010 4
#> 2 70115 0.0700244 6.151e-02 0.0831270 6.984e-02 2202 2010 4
#> 3 70119 0.0689893 7.905e-02 0.0521159 6.916e-02 2202 2010 4
#> 4 70058 0.0621786 5.956e-02 0.1148918 6.382e-02 2202 2010 4
#> 5 70094 0.0559088 2.953e-02 0.0506084 5.374e-02 2202 2010 4
#> 6 70117 0.0563989 3.658e-02 0.0189512 5.360e-02 2202 2010 4
#> 7 70122 0.0560060 2.443e-02 0.0243351 5.252e-02 2202 2010 4
#> 8 70130 0.0438001 1.326e-01 0.1001400 5.245e-02 2202 2010 4
#> 9 70114 0.0511557 3.982e-02 0.0505007 5.028e-02 2202 2010 4
#> 10 70118 0.0520726 2.443e-02 0.0325186 4.931e-02 2202 2010 4
#> 11 70131 0.0484644 1.244e-02 0.0328416 4.521e-02 2202 2010 4
#> 12 70126 0.0421946 2.998e-02 0.0360719 4.106e-02 2202 2010 4
#> 13 70127 0.0378133 2.358e-02 0.0369333 3.671e-02 2202 2010 4
#> 14 70056 0.0353248 2.828e-02 0.0390869 3.493e-02 2202 2010 4
#> 15 70116 0.0319406 4.517e-02 0.0675137 3.418e-02 2202 2010 4
#> 16 70065 0.0333898 1.114e-02 0.0648218 3.281e-02 2202 2010 4
#> 17 70062 0.0249526 8.814e-02 0.0412404 3.028e-02 2202 2010 4
#> 18 70125 0.0298282 2.718e-02 0.0187359 2.924e-02 2202 2010 4
#> 19 70128 0.0290761 5.197e-03 0.0043071 2.641e-02 2202 2010 4
#> 20 70113 0.0189405 3.168e-02 0.0330570 2.039e-02 2202 2010 4
#> 21 70053 0.0186194 4.232e-02 0.0179821 2.038e-02 2202 2010 4
#> 22 70112 0.0134058 5.072e-02 0.0194896 1.643e-02 2202 2010 4
#> 23 70129 0.0139466 1.404e-02 0.0059223 1.367e-02 2202 2010 4
#> 24 70003 0.0064473 1.054e-02 0.0052762 6.715e-03 2202 2010 4
#> 25 70121 0.0040264 6.396e-03 0.0055992 4.260e-03 2202 2010 4
#> 26 70124 0.0045376 1.049e-03 0.0015075 4.169e-03 2202 2010 4
#> 27 70123 0.0016308 7.995e-04 0.0023689 1.594e-03 2202 2010 4
#> 28 70001 0.0004352 8.944e-03 0.0007537 1.087e-03 2202 2010 4
#> 29 70067 0.0011745 3.498e-04 0.0000000 1.071e-03 2202 2010 4
#> 30 70170 0.0000000 5.496e-03 0.0003230 4.248e-04 2202 2010 4
#> 31 70163 0.0000000 4.597e-03 0.0002154 3.534e-04 2202 2010 4
#> 32 70139 0.0000000 3.698e-03 0.0002154 2.857e-04 2202 2010 4
#> 33 70146 0.0000000 4.997e-04 0.0002154 4.511e-05 2202 2010 4
#> 34 70143 0.0000000 4.997e-05 0.0000000 3.760e-06 2202 2010 4
#> 35 70165 0.0000000 4.997e-05 0.0000000 3.760e-06 2202 2010 4
#> 36 70141 0.0000000 4.997e-05 0.0000000 3.760e-06 2202 2010 4
hud_cw_zip_countysub(zip = '35213', year = c('2019'), quarter = c('2'))
#>
: [==================================================] 100% 1/1
Downloading#> countysub res_ratio bus_ratio oth_ratio tot_ratio zip year quarter
#> 1 0107390324 1 1 1 1 35213 2019 2
hud_cw_countysub_zip(countysub = '4606720300 ', year = c('2019', '2019', '2019'),
quarter = c('4','4'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio countysub year quarter
#> 1 57376 1 1 0 1 4606720300 2019 4
If you just want the crosswalked geoids, you can set the minimal argument to TRUE. This will return a vector containing the crosswalked geoids without the extra metadata.
hud_cw_county_zip(county = '22031', year = c('2010'), quarter = c('1'), minimal = TRUE)
#>
: [==================================================] 100% 1/1
Downloading#> [1] "71052" "71078" "71049" "71032" "71027" "71030" "71046" "71063" "71419"
#> [10] "71065"
The omni function is a redundant implementation of the functions shown above that requires specifying the type which can be from 1-12. The type argument follows the number scheme described at within the [input arguments][Input Arguments]. You also must use the ‘query’ argument (i.e query = 22031) for inputting geoids instead of the specific geoid names (i.e county = 22031, cd = 7200) used by the above functions.
hud_cw(type = 7, query = '22031', year = c('2010'), quarter = c('1'))
#>
: [==================================================] 100% 1/1
Downloading#> zip res_ratio bus_ratio oth_ratio tot_ratio county year quarter
#> 1 71052 0.4322130 0.699634 0.56338 0.4455100 22031 2010 1
#> 2 71078 0.1816700 0.086081 0.15493 0.1770400 22031 2010 1
#> 3 71049 0.1103580 0.065934 0.15493 0.1085520 22031 2010 1
#> 4 71032 0.0813449 0.040293 0.01408 0.0790172 22031 2010 1
#> 5 71027 0.0699566 0.047619 0.04225 0.0687441 22031 2010 1
#> 6 71030 0.0435647 0.020147 0.04225 0.0424621 22031 2010 1
#> 7 71046 0.0425705 0.021978 0.01408 0.0414348 22031 2010 1
#> 8 71063 0.0275669 0.014652 0.01408 0.0268813 22031 2010 1
#> 9 71419 0.0105748 0.003663 0.00000 0.0101875 22031 2010 1
#> 10 71065 0.0001808 0.000000 0.00000 0.0001712 22031 2010 1
For those who need to apply an allocation method (residential, business, other, total) to individual items in a data set, the crosswalk() function is available. Lets say we wanted to know the population at a zip code level (there is likely already a data set for this) for the counties of Washington, Wicomico, and Worchester in Maryland in the year 2019.
NOTE: The use of the crosswalk() function is likely best suited for datasets that are not described in the geographic identifier we want to crosswalk to. In this case population might not be the best example for this.
sample <- data.frame(pop = c(151049, 103609, 52276),
county = c("24043", "24045", "24047"))
head(sample)
#> pop county
#> 1 151049 24043
#> 2 103609 24045
#> 3 52276 24047
In the crosswalked data set below each zip code associated with a county is assigned the same population value.
crosswalk(data = sample, geoid = "county", geoid_col = "county",
cw_geoid = "zip", cw_geoid_col = NA, method = NA, year = 2019
quarter = 1)
, #>
: [=================---------------------------------] 33% 1/3
Downloading: [=================================-----------------] 67% 2/3
Downloading: [==================================================] 100% 3/3
Downloading#>
#>
#> * No method or cw_geoid_col specified: will just merge the datasets.
#> county zip res_ratio bus_ratio oth_ratio tot_ratio year quarter pop
#> 1 24043 21740 4.154e-01 0.5855329 0.6520012 4.388e-01 2019 1 151049
#> 2 24043 21742 2.269e-01 0.2051453 0.2022609 2.242e-01 2019 1 151049
#> 3 24043 21795 7.331e-02 0.0689943 0.0498014 7.197e-02 2019 1 151049
#> 4 24043 21713 5.965e-02 0.0295690 0.0192484 5.558e-02 2019 1 151049
#> 5 24043 21783 4.411e-02 0.0126963 0.0033608 3.993e-02 2019 1 151049
#> 6 24043 21722 3.437e-02 0.0075175 0.0030553 3.094e-02 2019 1 151049
#> 7 24043 21750 2.974e-02 0.0414300 0.0262756 3.051e-02 2019 1 151049
#> 8 24043 21782 2.497e-02 0.0046776 0.0009166 2.237e-02 2019 1 151049
#> 9 24043 21756 2.179e-02 0.0018376 0.0009166 1.934e-02 2019 1 151049
#> 10 24043 21767 1.567e-02 0.0145339 0.0137489 1.550e-02 2019 1 151049
#> 11 24043 21719 1.093e-02 0.0030070 0.0265811 1.098e-02 2019 1 151049
#> 12 24043 21734 1.081e-02 0.0150351 0.0012221 1.073e-02 2019 1 151049
#> 13 24043 21758 1.118e-02 0.0030070 0.0006111 1.010e-02 2019 1 151049
#> 14 24043 21733 6.992e-03 0.0021717 0.0000000 6.318e-03 2019 1 151049
#> 15 24043 21711 6.903e-03 0.0015035 0.0000000 6.187e-03 2019 1 151049
#> 16 24043 21779 5.866e-03 0.0016706 0.0000000 5.289e-03 2019 1 151049
#> 17 24043 21715 5.481e-04 0.0001671 0.0000000 4.950e-04 2019 1 151049
#> 18 24043 21780 4.740e-04 0.0000000 0.0000000 4.168e-04 2019 1 151049
#> 19 24043 21769 2.370e-04 0.0003341 0.0000000 2.345e-04 2019 1 151049
#> 20 24043 21720 2.963e-05 0.0001671 0.0000000 3.908e-05 2019 1 151049
#> 21 24043 21746 0.000e+00 0.0005012 0.0000000 3.908e-05 2019 1 151049
#> 22 24043 21755 1.481e-05 0.0000000 0.0000000 1.303e-05 2019 1 151049
#> 23 24043 21781 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 151049
#> 24 24043 21721 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 151049
#> 25 24043 21741 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 151049
#> 26 24045 21804 3.617e-01 0.2666006 0.4497751 3.574e-01 2019 1 103609
#> 27 24045 21801 2.563e-01 0.4428147 0.4677661 2.830e-01 2019 1 103609
#> 28 24045 21826 6.512e-02 0.0471754 0.0228636 6.152e-02 2019 1 103609
#> 29 24045 21875 6.282e-02 0.0243806 0.0356072 5.809e-02 2019 1 103609
#> 30 24045 21802 4.247e-02 0.1117939 0.0007496 4.670e-02 2019 1 103609
#> 31 24045 21830 3.543e-02 0.0059465 0.0018741 3.121e-02 2019 1 103609
#> 32 24045 21849 3.141e-02 0.0053518 0.0052474 2.784e-02 2019 1 103609
#> 33 24045 21850 2.981e-02 0.0114965 0.0089955 2.719e-02 2019 1 103609
#> 34 24045 21837 2.548e-02 0.0105055 0.0026237 2.306e-02 2019 1 103609
#> 35 24045 21874 2.180e-02 0.0073340 0.0022489 1.958e-02 2019 1 103609
#> 36 24045 21803 1.634e-02 0.0537166 0.0003748 1.893e-02 2019 1 103609
#> 37 24045 21822 1.714e-02 0.0043608 0.0007496 1.522e-02 2019 1 103609
#> 38 24045 21856 9.956e-03 0.0033697 0.0000000 8.897e-03 2019 1 103609
#> 39 24045 21861 8.827e-03 0.0001982 0.0011244 7.692e-03 2019 1 103609
#> 40 24045 21865 5.789e-03 0.0025768 0.0000000 5.228e-03 2019 1 103609
#> 41 24045 21840 5.112e-03 0.0011893 0.0000000 4.519e-03 2019 1 103609
#> 42 24045 21814 4.434e-03 0.0005946 0.0000000 3.881e-03 2019 1 103609
#> 43 24045 21852 0.000e+00 0.0003964 0.0000000 3.545e-05 2019 1 103609
#> 44 24045 21810 0.000e+00 0.0001982 0.0000000 1.772e-05 2019 1 103609
#> 45 24047 21842 5.302e-01 0.4559211 0.8379953 5.443e-01 2019 1 52276
#> 46 24047 21811 2.832e-01 0.2535088 0.0927739 2.696e-01 2019 1 52276
#> 47 24047 21851 5.434e-02 0.0881579 0.0417249 5.577e-02 2019 1 52276
#> 48 24047 21843 4.340e-02 0.1065789 0.0009324 4.491e-02 2019 1 52276
#> 49 24047 21863 3.859e-02 0.0660088 0.0205128 3.927e-02 2019 1 52276
#> 50 24047 21813 2.390e-02 0.0160088 0.0048951 2.221e-02 2019 1 52276
#> 51 24047 21841 7.577e-03 0.0041667 0.0004662 6.918e-03 2019 1 52276
#> 52 24047 21872 6.003e-03 0.0039474 0.0004662 5.528e-03 2019 1 52276
#> 53 24047 21864 4.920e-03 0.0017544 0.0000000 4.411e-03 2019 1 52276
#> 54 24047 21829 3.411e-03 0.0008772 0.0000000 3.036e-03 2019 1 52276
#> 55 24047 21804 1.804e-03 0.0004386 0.0000000 1.604e-03 2019 1 52276
#> 56 24047 21862 1.263e-03 0.0024123 0.0002331 1.275e-03 2019 1 52276
#> 57 24047 21822 1.361e-03 0.0000000 0.0000000 1.189e-03 2019 1 52276
#> 58 24047 21792 0.000e+00 0.0002193 0.0000000 1.432e-05 2019 1 52276
To utilize an allocation method provided by the crosswalk files and apply it to columns of the data set, specify the method and cw_geoid_col arguments. In this case we want to allocate the county population levels to a zip code level using the method based on the ratio of residential addresses.
crosswalk(data = sample, geoid = "county", geoid_col = "county",
cw_geoid = "zip", cw_geoid_col = "pop", method = "res", year = 2019
quarter = 1)
, #>
: [=================---------------------------------] 33% 1/3
Downloading: [=================================-----------------] 67% 2/3
Downloading: [==================================================] 100% 3/3
Downloading#>
#>
#> * Applying allocation method based on residential address percentage.
#> county zip res_ratio bus_ratio oth_ratio tot_ratio year quarter pop
#> 1 24043 21740 4.154e-01 0.5855329 0.6520012 4.388e-01 2019 1 62751.933
#> 2 24043 21742 2.269e-01 0.2051453 0.2022609 2.242e-01 2019 1 34280.196
#> 3 24043 21795 7.331e-02 0.0689943 0.0498014 7.197e-02 2019 1 11073.212
#> 4 24043 21713 5.965e-02 0.0295690 0.0192484 5.558e-02 2019 1 9010.270
#> 5 24043 21783 4.411e-02 0.0126963 0.0033608 3.993e-02 2019 1 6663.170
#> 6 24043 21722 3.437e-02 0.0075175 0.0030553 3.094e-02 2019 1 5190.918
#> 7 24043 21750 2.974e-02 0.0414300 0.0262756 3.051e-02 2019 1 4492.829
#> 8 24043 21782 2.497e-02 0.0046776 0.0009166 2.237e-02 2019 1 3772.365
#> 9 24043 21756 2.179e-02 0.0018376 0.0009166 1.934e-02 2019 1 3291.310
#> 10 24043 21767 1.567e-02 0.0145339 0.0137489 1.550e-02 2019 1 2367.238
#> 11 24043 21719 1.093e-02 0.0030070 0.0265811 1.098e-02 2019 1 1651.249
#> 12 24043 21734 1.081e-02 0.0150351 0.0012221 1.073e-02 2019 1 1633.349
#> 13 24043 21758 1.118e-02 0.0030070 0.0006111 1.010e-02 2019 1 1689.286
#> 14 24043 21733 6.992e-03 0.0021717 0.0000000 6.318e-03 2019 1 1056.083
#> 15 24043 21711 6.903e-03 0.0015035 0.0000000 6.187e-03 2019 1 1042.659
#> 16 24043 21779 5.866e-03 0.0016706 0.0000000 5.289e-03 2019 1 886.036
#> 17 24043 21715 5.481e-04 0.0001671 0.0000000 4.950e-04 2019 1 82.786
#> 18 24043 21780 4.740e-04 0.0000000 0.0000000 4.168e-04 2019 1 71.599
#> 19 24043 21769 2.370e-04 0.0003341 0.0000000 2.345e-04 2019 1 35.799
#> 20 24043 21720 2.963e-05 0.0001671 0.0000000 3.908e-05 2019 1 4.475
#> 21 24043 21746 0.000e+00 0.0005012 0.0000000 3.908e-05 2019 1 0.000
#> 22 24043 21755 1.481e-05 0.0000000 0.0000000 1.303e-05 2019 1 2.237
#> 23 24043 21781 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 0.000
#> 24 24043 21721 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 0.000
#> 25 24043 21741 0.000e+00 0.0001671 0.0000000 1.303e-05 2019 1 0.000
#> 26 24045 21804 3.617e-01 0.2666006 0.4497751 3.574e-01 2019 1 37479.352
#> 27 24045 21801 2.563e-01 0.4428147 0.4677661 2.830e-01 2019 1 26557.357
#> 28 24045 21826 6.512e-02 0.0471754 0.0228636 6.152e-02 2019 1 6746.751
#> 29 24045 21875 6.282e-02 0.0243806 0.0356072 5.809e-02 2019 1 6508.531
#> 30 24045 21802 4.247e-02 0.1117939 0.0007496 4.670e-02 2019 1 4400.703
#> 31 24045 21830 3.543e-02 0.0059465 0.0018741 3.121e-02 2019 1 3671.152
#> 32 24045 21849 3.141e-02 0.0053518 0.0052474 2.784e-02 2019 1 3254.265
#> 33 24045 21850 2.981e-02 0.0114965 0.0089955 2.719e-02 2019 1 3088.362
#> 34 24045 21837 2.548e-02 0.0105055 0.0026237 2.306e-02 2019 1 2639.571
#> 35 24045 21874 2.180e-02 0.0073340 0.0022489 1.958e-02 2019 1 2258.843
#> 36 24045 21803 1.634e-02 0.0537166 0.0003748 1.893e-02 2019 1 1693.069
#> 37 24045 21822 1.714e-02 0.0043608 0.0007496 1.522e-02 2019 1 1776.021
#> 38 24045 21856 9.956e-03 0.0033697 0.0000000 8.897e-03 2019 1 1031.581
#> 39 24045 21861 8.827e-03 0.0001982 0.0011244 7.692e-03 2019 1 914.597
#> 40 24045 21865 5.789e-03 0.0025768 0.0000000 5.228e-03 2019 1 599.806
#> 41 24045 21840 5.112e-03 0.0011893 0.0000000 4.519e-03 2019 1 529.616
#> 42 24045 21814 4.434e-03 0.0005946 0.0000000 3.881e-03 2019 1 459.426
#> 43 24045 21852 0.000e+00 0.0003964 0.0000000 3.545e-05 2019 1 0.000
#> 44 24045 21810 0.000e+00 0.0001982 0.0000000 1.772e-05 2019 1 0.000
#> 45 24047 21842 5.302e-01 0.4559211 0.8379953 5.443e-01 2019 1 27719.003
#> 46 24047 21811 2.832e-01 0.2535088 0.0927739 2.696e-01 2019 1 14804.331
#> 47 24047 21851 5.434e-02 0.0881579 0.0417249 5.577e-02 2019 1 2840.491
#> 48 24047 21843 4.340e-02 0.1065789 0.0009324 4.491e-02 2019 1 2268.620
#> 49 24047 21863 3.859e-02 0.0660088 0.0205128 3.927e-02 2019 1 2017.408
#> 50 24047 21813 2.390e-02 0.0160088 0.0048951 2.221e-02 2019 1 1249.199
#> 51 24047 21841 7.577e-03 0.0041667 0.0004662 6.918e-03 2019 1 396.108
#> 52 24047 21872 6.003e-03 0.0039474 0.0004662 5.528e-03 2019 1 313.800
#> 53 24047 21864 4.920e-03 0.0017544 0.0000000 4.411e-03 2019 1 257.213
#> 54 24047 21829 3.411e-03 0.0008772 0.0000000 3.036e-03 2019 1 178.334
#> 55 24047 21804 1.804e-03 0.0004386 0.0000000 1.604e-03 2019 1 94.311
#> 56 24047 21862 1.263e-03 0.0024123 0.0002331 1.275e-03 2019 1 66.018
#> 57 24047 21822 1.361e-03 0.0000000 0.0000000 1.189e-03 2019 1 71.162
#> 58 24047 21792 0.000e+00 0.0002193 0.0000000 1.432e-05 2019 1 0.000
query: character double integer or numeric
year: character double integer or numeric
quarter: character double integer or numeric
minimal: logical
key: character
Data Field | Description |
---|---|
zip/county/fipstract/cbsa/cbsadiv/cd/countysub | The geoid to query for |
res_ratio | The ratio of residential addresses in the ZIP – Tract, County, or CBSA part to the total number of residential addresses in the entire ZIP. (for type 1-5 and 11) The ratio of residential addresses in the Zip, Tract, County, or CBSA - ZIP part to the total number of residential addresses in the entire Zip, Tract, County, or CBSA. (for type 6-10 and 12) |
bus_ratio | The ratio of business addresses in the ZIP – Tract, County, or CBSA part to the total number of business addresses in the entire ZIP. (for type 1-5 and 11). The ratio of business addresses in the Tract, County, or CBSA – ZIP part to the total number of business addresses in the entire Tract, County, or CBSA. (for type 6-10 and 12) |
oth_ratio | The ratio of other addresses in the ZIP – Tract to the total number of other addresses in the entire ZIP. (for type 1-5 and 11). The ratio of other addresses in the Tract, County, or CBSA – ZIP part to the total number of other addresses in the entire Tract, County, or CBSA. (for type 6-10 and 12) |
tot_ratio | The ratio of all addresses in the ZIP – Tract to the total number of all types of addresses in the entire ZIP. (for type 1-5 and 11) The ratio of all addresses in the Tract, County, or CBSA-ZIP part to the total number of all types of addresses in the entire Tract, County, or CBSA. (for type 6-10 and 12) |
zip/county/fipstract/cbsa/cbsadiv/cd/countysub | The intersecting geoids depending on function call |
year | Year the measurement was taken. |
quarter | Quarter of year when measurement was taken. |