R for Political Data Science
A repository to provide a central location for the files and data used in my weekly posts on analyzing political data in R. Inspired by the folks participating in Tidy Tuesday, I'm really intending this to be an introduction to techniques of data science that have real world applied use cases. Again, read more on my blog.
My DataCamp Course and R Package
If you're looking for a more guided introduction to the topic, consider taking my course "Analyzing Polling and Election Data in R" at DataCamp.com. And, of course, check out my R package
politicaldata that makes downloading and analyzing a lot of these data even easier.
A Guide to Analyzing Political Data in R
I am preparing a guide on how to analyze and visualize political data in R, which compiles much of the work here into a longer, more cohesive format. It is not quite long enough to be a book, but will (in the end) be fairly comprehensive. The materials for this text can be found in the
An overview of this repository's files for the weekly posts detailed below:
/data/subdirectory is a list of all the data used in each post, cleaned up and ready to be imported.
/scripts/subdirectory contains scripts that analyze the datasets. These scripts are made of all the same code included in the posts, but the commentary is stripped away.
If your code doesn't work, make sure you've removed references to my personal R theme,
theme_elliott(), which I suggest replacing with
theme_minimal(). If you're still having trouble, open an issue with a reproducible example (which you can generate easily in R using
Data and posts
Here is a table of all the posts, data, and scripts in chronological order:
|2019-01-04||Polarization in the 115h Congress|
|2019-01-11||This Early Before 2020, It’s All About Name Recognition|
|2019-01-18||How Marginal Tax Rates Work|
|2019-01-25||What Happens To Our Algorithms When Socialists Vote in Congress|
|2019-02-01||The Ideological Diversity of the American Electorate|
|2019-02-08||Just How Liberal Are the 2020 Democratic Candidates?|
|2019-02-15||The 2020 Twitter Primary|