Non-geographic partner function to geo_estimate_down. Allows users to estimate down without the costly matching operation if they've already matched.

estimate_down(wts, value, group)

Arguments

wts

numeric vector. Defaults to 1. Typically population or VAP, as a weight to give each precinct.

value

numeric vector. Defaults to 1. Typically electoral outcomes, as a value to estimate down into blocks.

group

matches of length(wts) that correspond to row indices of value. Often, this input is the output of geo_match.

Value

numeric vector with each value split by weight

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
set.seed(1)
data(checkerboard)
counties <- checkerboard %>%
  group_by(id <= 32) %>%
  summarize(geometry = sf::st_union(geometry)) %>%
  mutate(pop = c(100, 200))
matches <- geo_match(checkerboard, counties)
#> Warning: Planarizing skipped. `x` missing CRS.
#> Warning: Planarizing skipped. `x` missing CRS.
estimate_down(wts = rep(1, nrow(checkerboard)), value = counties$pop, group = matches)
#>  [1] 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250
#> [13] 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250
#> [25] 6.250 6.250 6.250 6.250 6.250 6.250 6.250 6.250 3.125 3.125 3.125 3.125
#> [37] 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125
#> [49] 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125 3.125
#> [61] 3.125 3.125 3.125 3.125