Created
February 21, 2021 14:53
-
-
Save smach/1201646acc9f86fdcc4c770b699a8966 to your computer and use it in GitHub Desktop.
RStudio code snippet for combining smaller polygons (precincts) into larger polygons (City Council Districts)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet mygis_dt_merge_districts_2_precincts | |
${1:my_geography} <- as.data.table(${1:my_geography}) | |
${2:my_new_geography} <- fram2[, .(geometry = st_union(geometry)), by = ${3:larger_district}] | |
${2:my_new_geography} <- sf::st_sf(${2:my_new_geography}) | |
# test plot | |
# ggplot(${2:my_new_geography}, aes(geometry=geometry)) + | |
# geom_sf() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment