Skip to content

Instantly share code, notes, and snippets.

@arvi1000
Last active November 16, 2016 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvi1000/a3783cb5644a4324851dd7a1f0d1bdf6 to your computer and use it in GitHub Desktop.
Save arvi1000/a3783cb5644a4324851dd7a1f0d1bdf6 to your computer and use it in GitHub Desktop.
Which Congressional districts have spoken out against Bannon?
# you must: source('z_load_data.R')
stopifnot(exists('dat'))
library(tigris)
library(leaflet)
# load congressional districts
cong <- tigris::congressional_districts(cb=TRUE)
# add state and district number in form of (AK-1)
cong@data$state <-
with(fips_codes, state[match(cong@data$STATEFP, state_code)])
cong@data$name <- with(
cong@data,
paste0('(', state, '-', as.numeric(substr(GEOID, 3, 4))+1, ')')
)
# munge data from boston globe
no_bannon <-
sub('^.* \\(', '\\(', dat[, 1]) %>%
sub('At large', '1', .) %>%
sub('(DC)', '(DC-1)', ., fixed = T)
# mark districts
cong@data$no_bannon <- cong@data$name %in% no_bannon
pal <- function(x) ifelse(x, 'navy', 'orangered')
leaflet(cong) %>%
# default to center, medium zoom for lower 48
setView(lat = 39.8282, lng = -98.5795, zoom=3) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(stroke=F, smoothFactor = 0.2, fillOpacity = 0.7,
fillColor = ~pal(no_bannon))
# Pasted from http://www.bostonglobe.com/news/politics/2016/11/16/more-than-house-members-urge-trump-rescind-bannon-appointment/57MFSBYKGNI0RcP0nVwIWL/story.html
dat <- read.table(header = F, sep='\n', stringsAsFactors = F, text =
"David N. Cicilline (RI-1)
Alma Adams (NC-12)
Pete Aguilar (CA-31)
Karen Bass (CA-37)
Joyce Beatty (OH-3)
Xavier Becerra (CA-34)
Ami Bera (CA-7)
Donald Beyer (VA-8)
Sanford Bishop (GA-2)
Earl Blumenauer (OR-3)
Suzanne Bonamici (OR-1)
Madeleine Bordallo (Guam)
Brendan Boyle (PA-13)
Robert Brady (PA-1)
Julia Brownley (CA-26)
Cheri Bustos (IL-17)
G.K. Butterfield (NC-1)
Michael Capuano (MA-7)
Tony Cardenas (CA-29)
John Carney (DE-At large)
Andre Carson (IN-7)
Matt Cartwright (PA-17)
Kathy Castor (FL-14)
Joaquin Castro (TX-20)
Judy Chu (CA-27)
Katherine Clark (MA-5)
Yvette Clarke (NY-9)
William Lacy Clay (MO-1)
Emanuel Cleaver (MO-5)
James Clyburn (SC-6)
Steve Cohen (TN-9)
Gerald Connolly (VA-11)
John Conyers (MI-13)
Jim Cooper (TN-5)
Joe Courtney (CT-2)
Joseph Crowley (NY-14)
Elijah Cummings (MD-7)
Danny Davis (IL-7)
Susan Davis (CA-53)
Peter DeFazio (OR-4)
Diana DeGette (CO-1)
John Delaney (MD-6)
Rosa DeLauro (CT-3)
Suzan DelBene (WA-1)
Mark DeSaulnier (CA-11)
Ted Deutch (FL-21)
Debbie Dingell (MI-12)
Lloyd Doggett (TX-35)
Michael Doyle (PA-14)
Tammy Duckworth (IL-8)
Donna Edwards (MD-4)
Keith Ellison (MN-5)
Eliot Engel (NY-16)
Anna Eshoo (CA-18)
Elizabeth Esty (CT-5)
Dwight Evans (PA-2)
Sam Farr (CA-20)
Bill Foster (IL-11)
Lois Frankel (FL-22)
Marcia Fudge (OH-11)
Ruben Gallego (AZ-7)
John Garamendi (CA-3)
Gwen Graham (FL-2)
Al Green (TX-9)
Gene Green (TX-29)
Raul Grijalva (AZ-3)
Luis Gutierrez (IL-4)
Janice Hahn (CA-44)
Colleen Hanabusa (HI-1)
Alcee Hastings (FL-20)
Denny Heck (WA-10)
Brian Higgins (NY-26)
James Himes (CT-4)
Ruben Hinojosa (TX-15)
Michael Honda (CA-17)
Jared Huffman (CA-2)
Steve Israel (NY-3)
Sheila Jackson Lee (TX-18)
Hakeem Jeffries (NY-8)
Eddie Bernice Johnson (TX-30)
Hank Johnson (GA-4)
Marcy Kaptur (OH-9)
William Keating (MA-9)
Robin Kelly (IL-2)
Joseph Kennedy (MA-4)
Dan Kildee (MI-5)
Derek Kilmer (WA-6)
Ron Kind (WI-3)
Ann Marie Kuster (NH-2)
James Langevin (RI-2)
Rick Larsen (WA-2)
John Larson (CT-1)
Brenda Lawrence (MI-14)
Barbara Lee (CA-13)
Sander Levin (MI-9)
John Lewis (GA-5)
Ted Lieu (CA-33)
Dave Loebsack (IA-2)
Zoe Lofgren (CA-19)
Alan Lowenthal (CA-47)
Nita Lowey (NY-17)
Ben Ray Lujan (NM-3)
Michelle Lujan Grisham (NM-1)
Stephen Lynch (MA-8)
Carolyn Maloney (NY-12)
Sean Patrick Maloney (NY-18)
Doris Matsui (CA-6)
Betty McCollum (MN-4)
Jim McDermott (WA-7)
James McGovern (MA-2)
Jerry McNerney (CA-9)
Gregory Meeks (NY-5)
Grace Meng (NY-6)
Gwen Moore (WI-4)
Seth Moulton (MA-6)
Patrick Murphy (FL-18)
Jerrold Nadler (NY-10)
Grace Napolitano (CA-32)
Richard Neal (MA-1)
Richard Nolan (MN-8)
Donald Norcross (NJ-1)
Eleanor Holmes Norton (DC)
Beto O’Rourke (TX-16)
Frank Pallone (NJ-6)
Bill Pascrell (NJ-9)
Donald Payne Jr. (NJ-10)
Ed Perlmutter (CO-7)
Scott Peters (CA-52)
Chellie Pingree (ME-1)
Mark Pocan (WI-2)
Jared Polis (CO-2)
David Price (NC-4)
Mike Quigley (IL-5)
Kathleen Rice (NY-4)
Cedric Richmond (LA-2)
Lucille Roybal-Allard (CA-40)
Raul Ruiz (CA-36)
Tim Ryan (OH-13)
Linda Sanchez (CA-38)
John Sarbanes (MD-3)
Jan Schakowsky (IL-9)
Adam Schiff (CA-28)
Kurt Schrader (OR-5)
Bobby Scott (VA-3)
Jose Serrano (NY-15)
Terri Sewell (AL-7)
Albio Sires (NJ-8)
Louise McIntosh Slaughter (NY-25)
Adam Smith (WA-9)
Jackie Speier (CA-14)
Eric Swalwell (CA-15)
Mark Takano (CA-41)
Bennie Thompson (MS-2)
Mike Thompson (CA-5)
Dina Titus (NV-1)
Paul Tonko (NY-20)
Norma Torres (CA-35)
Niki Tsongas (MA-3)
Chris Van Hollen (MD-8)
Juan Vargas (CA-51)
Marc Veasey (TX-33)
Nydia Velazquez (NY-7)
Timothy Walz (MN-1)
Debbie Wasserman Schultz (FL-23)
Maxine Waters (CA-43)
Bonnie Watson Coleman (NJ-12)
Peter Welch (VT-At large)
Frederica Wilson (FL-24)
John Yarmuth (KY-3)")
@arvi1000
Copy link
Author

Leaflet screen cap:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment