Aggregate values from a smaller geography to a larger geography after matching
each row of from to a row of to. This is commonly used to roll block-level
counts up to precincts or districts.
geo_estimate_up(from, to, value, method = "center", epsg = 3857)Smaller geography level.
Larger geography level.
Numeric vector of length nrow(from) to aggregate. Defaults to
1.
Matching method passed to geo_match().
numeric EPSG code to planarize to. Default is 3857.
numeric vector of length nrow(to) with values aggregated by group
Groups in to with no matched rows are included in the output and receive 0.
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_up(from = checkerboard, to = counties, value = checkerboard$i)
#> Warning: Planarizing skipped. `x` missing CRS.
#> Warning: Planarizing skipped. `x` missing CRS.
#> [1] 176 48