In performing a county-level or cores-based analysis it is often necessary to merge several units together into a larger unit. This function performs this operation, modifying the adjacency graph as needed and attempting to properly aggregate other data columns.

merge_by(.data, ..., by_existing = TRUE, drop_geom = TRUE, collapse_chr = TRUE)



a redist_map object


<tidy-select> the column(s) to merge by


if an existing assignment is present, whether to also group by it


whether to drop the geometry column. Recommended, as otherwise a costly geometric merge is required.


if TRUE, preserve character columns by collapsing their values. For example, a county name column in Iowa might be merged and have entries such as "Cedar~Clinton~Des Moines". Set to FALSE to drop character columns instead.


A merged redist_map object