Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Geographic Tools for Studying Gerrymandering

License

NotificationsYou must be signed in to change notification settings

christopherkenny/geomander

Repository files navigation

R-CMD-checkCRAN statusCRAN downloadsgeomander status badge

Focuses on creating data sets and other tools that help makeunderstanding gerrymandering faster and easier. Designed for easypreparation to run simulation analysis with the R package redist, but isaimed at the geographic aspects of redistricting, not partitioningmethods. Most of these tools are gathered from seminar papers and do notcorrespond to a single publication.

Installation

You can install the released version of geomander fromCRAN with:

install.packages("geomander")

And the development version fromGitHub with:

# install.packages("devtools")devtools::install_github("christopherkenny/geomander")

Examples

A very common task is aggregating block data to precincts.

library(geomander)library(tidyverse)#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──#> ✔ dplyr     1.1.4     ✔ readr     2.1.4#> ✔ forcats   1.0.0     ✔ stringr   1.5.1#> ✔ ggplot2   3.4.4     ✔ tibble    3.2.1#> ✔ lubridate 1.9.3     ✔ tidyr     1.3.0#> ✔ purrr     1.0.2#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──#> ✖ dplyr::filter() masks stats::filter()#> ✖ dplyr::lag()    masks stats::lag()#> ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors# load precinctsdata('va18sub')# create block datablock<- create_block_table(state='VA',county='087')# match the geographiesmatches<- geo_match(from=block,to=va18sub)# Aggregateprec<- block2prec(block_table=block,matches=matches)

Other important tasks include breaking data into pieces by blocksunderlying them.

library(geomander)library(tidyverse)# load precinctsdata("va18sub")# subset to target areava18sub<-va18sub|> filter(COUNTYFP=='087')

Then we can get common block data:

block<- create_block_table(state='VA',county='087')

And estimate down to blocks

disagg<- geo_estimate_down(from=va18sub,to=block,wts=block$vap,value=va18sub$G18USSRSTE)

For more information, see the documentation and vignettes, available athttps://christophertkenny.com/geomander/

About

Geographic Tools for Studying Gerrymandering

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp