Simple method for estimating data down to a lower level. This is most often useful for getting election data down from a precinct level to a block level in the case that a state or other jurisdiction split precincts when creating districts. Geographic partner to estimate_down.
geo_estimate_down(from, to, wts, value, method = "center", epsg = 3857)
Larger geography level
smaller geography level
numeric vector of length nrow(to). Defaults to 1. Typically population or VAP, as a weight to give each precinct.
numeric vector of length nrow(from). Defaults to 1. Typically electoral outcomes, as a value to estimate down into blocks.
string from center, centroid, point, or area for matching levels
numeric EPSG code to planarize to. Default is 3857.
numeric vector with each value split by weight
library(dplyr)
set.seed(1)
data(checkerboard)
counties <- checkerboard |>
group_by(id <= 32) |>
summarize(geometry = sf::st_union(geometry)) |>
mutate(pop = c(100, 200))
geo_estimate_down(from = counties, to = checkerboard, value = counties$pop)
#> Warning: Planarizing skipped. `x` missing CRS.
#> Warning: Planarizing skipped. `x` missing CRS.
#> [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