Skip to contents

Addresses are attempted to be matched to reference geographies using different methods associated with decreasing levels of precision in the order listed below. Each method generates matched s2 cell identifiers differently and is recorded in the match_method column of the returned tibble:

  1. ref_addr: reference s2 cell from direct match to reference address

  2. tiger_range: centroid of street-matched TIGER address ranges containing street number

  3. tiger_street: centroid of street-matched TIGER address ranges closest to the street number

  4. none: unmatched using all previous approaches; return missing s2 cell identifier

Usage

addr_match_geocode(
  x,
  ref_addr = cagis_addr()$cagis_addr,
  ref_s2,
  county = "39061",
  year = "2022"
)

Arguments

x

an addr vector (or character vector of address strings) to geocode

ref_addr

an addr vector to search for matches in

ref_s2

a s2_cell vector of locations for each ref_addr

county

character county identifer for TIGER street range files to search for matches in

year

character year for TIGER street range files to search for matches in

Value

a tibble with columns: addr contains x converted to an addr vector, s2 contains the resulting geocoded s2 cells as an s2cell vector, match_method is a factor with levels described above

Details

Performance was compared to the degauss geocoder (see /inst/compare_geocoding_to_degauss.R) using real-world addresses in voter_addresses(). Match success rates were similar, but DeGAUSS matched about 5% more of the addresses. These differences are sensitive to the match criteria considered for DeGAUSS (here precision of 'range' & score > 0.7 or precision of 'street' & score > 0.55):

addr_matcheddegauss_matchednperc
TRUETRUE22471492.8%
FALSETRUE134075.5%
FALSEFALSE29931.2%
TRUEFALSE10190.4%

Among those that were geocoded by both, 97.7% were geocoded to the same census tract, and 96.6% to the same block group:

ct_agreebg_agreens2_dist_ptiles (5th, 25th, 50th, 75th, 95th)perc
TRUETRUE21717914.7, 24.3, 39, 68.9, 153.696.6%
FALSEFALSE480521.6, 39.2, 158.9, 5577.9, 16998.82.1%
TRUEFALSE273019.6, 28.6, 41.2, 94.8, 571.81.2%

Examples

set.seed(1)
cagis_s2 <-
  cagis_addr()$cagis_addr_data |>
  purrr::modify_if(\(.) length(.) > 0 && nrow(.) > 1, dplyr::slice_sample, n = 1) |>
  purrr::map_vec(purrr::pluck, "cagis_s2", .default = NA, .ptype = s2::s2_cell())
addr_match_geocode(x = sample(voter_addresses(), 100), ref_s2 = cagis_s2) |>
  print(n = 100)
#> matching addresses in 24/36 ZIP codes [3.7s elapsed] 
#> matching addresses in 36/36 ZIP codes [5.8s elapsed] 
#> 
#> # A tibble: 100 × 3
#>                                                 addr s2             match_method
#>                                               <addr> <s2cell>       <fct>       
#>   1          5610 Leafwood Drive Cincinnati OH 45224 88404b4cb2636… ref_addr    
#>   2            833 Braemore Lane Cincinnati OH 45233 8841c9608ebda… ref_addr    
#>   3         NA W 514 Kemper Road Cincinnati OH 45246 NA           … none        
#>   4           7271 Berwood Drive Cincinnati OH 45243 8840535991ed3… ref_addr    
#>   5      4332 Cloverhill Terrace Cincinnati OH 45238 8841b63b5018d… ref_addr    
#>   6             3369 Stevie Lane Cincinnati OH 45239 88404ab1929c7… ref_addr    
#>   7         3584 Monteith Avenue Cincinnati OH 45208 8841ad80d655b… ref_addr    
#>   8           4513 Walter Avenue Cincinnati OH 45212 8841b292ca80f… ref_addr    
#>   9          6541 Rapid Run Road Cincinnati OH 45233 8841c960b8eaf… ref_addr    
#>  10           227 Central Avenue Cincinnati OH 45215 88404d707d303… ref_addr    
#>  11     3837 Mount Vernon Avenue Cincinnati OH 45209 8841ad78e8c62… tiger_range 
#>  12           1712 Bleecker Lane Cincinnati OH 45225 8841b4458f401… ref_addr    
#>  13           4166 Pillars Drive Cincinnati OH 45209 8841ad72fd065… ref_addr    
#>  14          5858 Blue Rock Road Cincinnati OH 45247 88403508010fa… ref_addr    
#>  15           6916 Hillary Drive Cincinnati OH 45239 88404ac46e5fe… ref_addr    
#>  16            9887 Marino Drive Cincinnati OH 45251 88404a43c3ac3… ref_addr    
#>  17          3738 Quadrant Drive North Bend OH 45052 8841cc88e64a5… ref_addr    
#>  18        10768 Bridlepath Lane Cincinnati OH 45241 884053d226188… ref_addr    
#>  19       3874 Enterprise Circle Cincinnati OH 45252 88404a751d9a4… ref_addr    
#>  20       1901 Beech Grove Drive Cincinnati OH 45233 8841ca33e1fbb… ref_addr    
#>  21          6725 Hudson Parkway Cincinnati OH 45213 884052ade7ebf… ref_addr    
#>  22          6705 E Ledge Street Cincinnati OH 45227 8841ace940c13… ref_addr    
#>  23         7108 Woodridge Drive Cincinnati OH 45230 8841aec8d4923… ref_addr    
#>  24              3767 Susandr NA Cincinnati OH 45251 NA           … none        
#>  25           6385 Gracely Drive Cincinnati OH 45233 8841c952c5cfb… ref_addr    
#>  26         7829 Dearborn Avenue Cincinnati OH 45236 884052dd90a55… tiger_range 
#>  27               9670 Weik Road Cincinnati OH 45252 8840345211140… ref_addr    
#>  28              3941 Oak Avenue Cincinnati OH 45236 884052d376128… ref_addr    
#>  29        NA S 169 Grove Avenue Cincinnati OH 45215 NA           … none        
#>  30              7269 Redridge Drive Cleves OH 45002 8840331fc7089… tiger_range 
#>  31         3412 Ferncroft Drive Cincinnati OH 45211 8841b5a1d26be… ref_addr    
#>  32            11923 Eider Drive Cincinnati OH 45246 88404ef28d755… ref_addr    
#>  33            7212 Reading Road Cincinnati OH 45237 88404d35eaaeb… ref_addr    
#>  34         2035 Highland Avenue Cincinnati OH 45224 88404b26af2fc… ref_addr    
#>  35     3291 Fiddlers Green Road Cincinnati OH 45248 8841cb867b2ff… ref_addr    
#>  36          5363 Teaberry Court Cincinnati OH 45238 8841c9ee95fda… ref_addr    
#>  37         968 Fairbanks Avenue Cincinnati OH 45205 8841b67f3e09b… ref_addr    
#>  38        7433 Heatherwood Lane Cincinnati OH 45244 8841abfdafbe4… ref_addr    
#>  39          2613 Hemlock Street Cincinnati OH 45206 8841b3c77c83d… ref_addr    
#>  40           7174 Pickway Drive Cincinnati OH 45233 8841cb8bfb1eb… ref_addr    
#>  41          3404 Telford Street Cincinnati OH 45220 8841b38716f66… ref_addr    
#>  42        3686 Neiheisel Avenue Cincinnati OH 45248 8841ca55f2f00… tiger_range 
#>  43            8991 Zodiac Drive Cincinnati OH 45231 88404afe4d588… ref_addr    
#>  44         3316 Hildreth Avenue Cincinnati OH 45211 8841ca7a39445… ref_addr    
#>  45        5233 Riverwatch Drive Cincinnati OH 45238 8841c9c4d48e3… ref_addr    
#>  46       1958 N Lynndale Avenue Cincinnati OH 45231 NA           … none        
#>  47        3396 Hammersmith Lane Cincinnati OH 45248 8841cb9c8cda8… ref_addr    
#>  48          2808 Galbraith W Rd Cincinnati OH 45239 NA           … none        
#>  49           2117 Fulton Avenue Cincinnati OH 45206 8841b3c53a4ff… ref_addr    
#>  50     3221 Dalmellington Court Cincinnati OH 45251 884049b94c72a… ref_addr    
#>  51          1024 Brayton Avenue Cincinnati OH 45215 88404c54e80cb… ref_addr    
#>  52       11478 Oxfordshire Lane Cincinnati OH 45240 88404942b2410… ref_addr    
#>  53         5538 Gwendolyn Ridge Cincinnati OH 45238 8841c98dda268… ref_addr    
#>  54    2650 Shaker Village Drive North Bend OH 45052 8841d275cad7d… tiger_range 
#>  55              995 Holz Avenue Cincinnati OH 45230 8841aefad8791… ref_addr    
#>  56               6429 Duet Lane Cincinnati OH 45239 88404aa562cd8… ref_addr    
#>  57                5705 Day Road Cincinnati OH 45252 884035dde8eaa… ref_addr    
#>  58          5725 Peabody Avenue Cincinnati OH 45227 8841ace266452… ref_addr    
#>  59       8173 Trotters NA Chase Cincinnati OH 45249 NA           … none        
#>  60              2440 Lysle Lane Cincinnati OH 45212 8841b2a5a6731… ref_addr    
#>  61            6537 Ridge Circle Cincinnati OH 45213 884052ab76861… ref_addr    
#>  62               339 Elm Street Cincinnati OH 45215 88404d7af0522… ref_addr    
#>  63         2050 Lawrence Avenue Cincinnati OH 45212 8841b292dabfa… ref_addr    
#>  64           3456 Ruther Avenue Cincinnati OH 45220 8841b384a89e9… ref_addr    
#>  65        7956 Autumnwind Drive Cincinnati OH 45249 884056c8d7df0… ref_addr    
#>  66             1613 Clio Avenue Cincinnati OH 45230 8841ae8cdf267… ref_addr    
#>  67            3647 Cornell Road Cincinnati OH 45241 884051864b521… ref_addr    
#>  68 8983 Terwilligers View Court Cincinnati OH 45249 8840567fe10d6… ref_addr    
#>  69         5219 Ostenhill Court Cincinnati OH 45238 8841c9c4aab9d… ref_addr    
#>  70          34 Stonehaven Drive North Bend OH 45052 8841cc53b6152… ref_addr    
#>  71             4570 Cooper Road Cincinnati OH 45242 884053a4f64c0… ref_addr    
#>  72          3814 Simpson Avenue Cincinnati OH 45227 8841acf89462a… ref_addr    
#>  73          9557 Linfield Drive Cincinnati OH 45242 884053a936ea9… ref_addr    
#>  74          2995 Alpine Terrace Cincinnati OH 45208 8841ad8bb3c97… ref_addr    
#>  75             4311 Erie Avenue Cincinnati OH 45227 8841ad0376e66… ref_addr    
#>  76          3634 Brockton Drive Cincinnati OH 45251 88404a7c4a774… ref_addr    
#>  77          208 Cherokee Avenue Cincinnati OH 45233 8841cc002d6fd… ref_addr    
#>  78              682 N Bay Court Cincinnati OH 45238 8841c9f3d30c0… ref_addr    
#>  79          4006 Longford Drive Cincinnati OH 45236 884052e150b07… ref_addr    
#>  80             3443 Bend Street Cincinnati OH 45244 8841ac6d63b1b… tiger_range 
#>  81           3436 Tangent Drive Cincinnati OH 45211 8841ca6139290… ref_addr    
#>  82           1219 Halpin Avenue Cincinnati OH 45208 8841ad8fca694… ref_addr    
#>  83            3738 Malaer Drive Cincinnati OH 45241 884051871cb44… ref_addr    
#>  84              3873 Creek Road Cincinnati OH 45241 8840522b0ef05… ref_addr    
#>  85            3219 Orion Avenue Cincinnati OH 45213 8841ad4e6cbc4… ref_addr    
#>  86          5807 Saranac Avenue Cincinnati OH 45224 88404b358dd0f… ref_addr    
#>  87          3156 Wolf Run Court Cincinnati OH 45244 8841abc5d3752… ref_addr    
#>  88        1010 Chatterton Drive Cincinnati OH 45231 88404c744d66f… ref_addr    
#>  89      4702 Shady Lawn Terrace Cincinnati OH 45238 8841b61cc88e9… ref_addr    
#>  90             336 Cameron Road Cincinnati OH 45246 88404e838aa4c… ref_addr    
#>  91        10853 Lakehurst Court Cincinnati OH 45242 88405403447c9… ref_addr    
#>  92            41 Carpenters Run Cincinnati OH 45241 8840524a93e18… ref_addr    
#>  93           9968 Timbers Drive Cincinnati OH 45242 884053b2e2e98… ref_addr    
#>  94       11951 Timberlake Drive Cincinnati OH 45249 88405694ac08e… ref_addr    
#>  95         812 Stanton Avenue Terrace Park OH 45174 8841ab1e22661… ref_addr    
#>  96            208 Riverside Drive Loveland OH 45140 8840f8adcfda2… tiger_range 
#>  97           414 Carmalt Street Cincinnati OH 45219 8841b3e67601c… ref_addr    
#>  98         4909 Winneste Avenue Cincinnati OH 45232 8841b3454ed59… ref_addr    
#>  99          5188 Whitmore Drive Cincinnati OH 45238 8841c9db61568… ref_addr    
#> 100          4518 Whetsel Avenue Cincinnati OH 45227 8841ace32ad3d… ref_addr