University of California Riverside

POSC 149 Summer 2017

Main Site

POSC 149: Presidential Elections

Welcome to my course page for Presidential Elections. One of my major goals for this class, was for my students to get some exposure to working with real data. I designed this course to allow for a large amount of hands-on activities. Students work with multiple datasets using Hadley Wickam’s excellent Tidyverse package in R. Some of the planned labs include: working with county-level election returns, scraping twitter for sentiment analysis, and exploring the 2016 CCES.

This page is divided into Lectures, Labs, and Help.


sshah018 [at] ucr [dot] edu

Political Science
University of California Riverside
Back to my main site

Here are the lectures for my current class:

Lab 4 : CCES Data

Today, we will be working with real public opinion data from the 2016 Cooperative Congressional Election Study (CCES). The CCES is a 50,000+ national stratified sample survey that is fielded during two waves during election years and is extremely popular for political science research. This data is what you will be using in your final paper project. (Lab Developed w/ Stephanie DeMora-Rettberg)

Lab 3: Social Media Data

In this lab, we will be working with data pulled directly from twitter. The most recent estimates show that Twitter alone has about 328 million active monthly users. Lucky for us, people tweet about everything! Although restaurant reviews and folks’ opinons about Game of Thrones probably doesn’t matter much for political scientists like us. . . We can use their opinions about candidates, and their policy preferences! In other words, it’s a really cheap, and quick way to collect contextual information about elections and public opinion. (Lab Developed w/ Stephanie DeMora-Rettberg)

Lab 1: Exploring county-level election data

This assignment will be a multi-part lab where you work with county-level election data from the 2012 and 2016 election and demographic data from the Census. County Level election data comes from The Guardian and Townhall, scraped by Tony McGovern.

Help |

Getting to Know Tidyverse


Here’s a tutorial largely adapted from the excellent e-book by Chester Ismay and Albert Y.Kim, An Introduction to Statistical and Data Sciences via R. The tutorial goes over the major functions used for data manipulation in Tidyverse.

Lab 1 Guide

Date: 08/08/17

Here’s a detailed guide to help you work through the first lab assignment.

R for Data Science

Date: 08/08/17

One of the best resources for getting started with R and Tidyverse.

2016 Election Data

Date: 2016

Great Visualization of the 2016 Election at the county level.