Skip to content

Instantly share code, notes, and snippets.

@conjugateprior
Created November 13, 2018 17:48
Show Gist options
  • Save conjugateprior/94d0f5bfbe778832c5fedecf7d83e7f3 to your computer and use it in GitHub Desktop.
Save conjugateprior/94d0f5bfbe778832c5fedecf7d83e7f3 to your computer and use it in GitHub Desktop.
Hours-reversing NC counties
library(tidyverse)
page <- "https://www.newsobserver.com/news/politics-government/election/article100235752.html"
decreasers <- read_html(page) %>% # grab and parse the webpage
html_table %>%
pluck(1) %>% # first (and only) table
mutate(h2016 = parse_number(`2016 Hours`), # parse ugly number formats
h2012 = parse_number(`2012 Hours`),
County = toupper(County)) %>%
filter((h2016 - h2012) < 0) %>%
use_series(County)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment