Skip to content

Instantly share code, notes, and snippets.

@tcash21
Last active November 24, 2016 03:46
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 tcash21/ddf62980414d9eea3b6515f466eab002 to your computer and use it in GitHub Desktop.
Save tcash21/ddf62980414d9eea3b6515f466eab002 to your computer and use it in GitHub Desktop.
library(benford.analysis)
## read in data
counties <- read.csv(file="https://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csvhttps://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csv")
## Run Benford tests
hrc <- benford(subset(counties, name == 'H. Clinton')$votes)
trump <- benford(subset(counties, name == 'D. Trump')$votes)
## plot results
plot(hrc)
plot(trump)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment