R

Data Blogging with R

Start a data blog to win friends and influence people

Use recursive partitioning and decision trees to guess someone's political opinions (using R with survey data)

Let’s say you meet someone at a dinner party, and you really want to know their opinion about some juicy political topic. If you’re me, you might just ask them straight up. But often, there are reasons why you can’t be so forward. Thankfully, political opinions are not randomly distributed. So if you can glean a few facts about someone, you can often predict their other, more hidden opinions. The challenge is knowing which pieces of small-talk are the most predictive of the jucier questions you can’t quite ask them.

Make interactive graphs of financial time-series in five minutes with R (Bitcoin example)

We’ll use two packages: The package Quandl for programmatically accessing a variety of financial time-series, and the package dygraphs for lovely interactive graphs based on the eponymous Javascript library. If you don’t already have them, install them. Below, we load the packages and run a search through the Quandl database to see what kind of variables we have to choose from. Feel free to explore your own interests and run the following example on a different variable.

How to make beautiful county maps of the US

First, you need to obtain an API key — it’s quick and easy. Go here, fill in the short form, and they’ll give you one immediately. You need to plug in your API key where you see XXXXXX below. To find variables of interest, I recommend the Census website’s advanced search. require(tidycensus) require(tidyverse) require(viridis) # Plug in your API key where the X's are; then uncomment that line. # census_api_key("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") ################################# ## Using the tidycensus package ################################# us.

Slides

In one week, you'll publish your first data-driven blog post — and gain your first readers. Guaranteed.

Inequality and the Pacification of Militant Protest in the United States, 1919-2012

To generate the graph below, you need two data files. The first is yearly income decile data from Piketty (2014), which should be named “Inequality_USA.csv.” The second is the Cross-National Time-Series data from Banks and Wilson (2017), which should be called “2017 Edition CNTSDATA.csv.” Finally, the code snippet below should be in a file called “Baron_et_al-ISQ.R” — that will be an R script that compiles the two datasets before producing the figure from our article.

The moral foundations of social justice warriors

Are Social Justice Warriors a real ideological faction of the Left, with a unique moral psychology? The first in a multi-part series using 'big data' to understand obscure ideological subcultures.

Data Blogging with R (Free Course)

Data Blogging with R (Free Course)

Generating summary statistics and box/violin plots in R

Start a basic data analysis with real data in R.

A quick-start guide to the statistical analysis of political attitudes and behaviors

Code and instructions to analyze the Eurobarometer using R.