Workshop on Social Media and Demographic Research - IUSSP - Cape Town 2017
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
01-retrieving-data-through-apis @ 0c3507b
02-IUSSP2017-twitter-module @ d6733ae
03-mapping-twitter-data @ 667d134
04-estimate-facebook-ads @ fb204c7


Workshop on Social Media and Demographic Research - IUSSP - Cape Town 2017

This repository contains the materials prepared by Emilio Zagheni 1 and Connor Gilroy 1 for the IUSSP 2017 Workshop on Social Media, Big Data and Digital Demography.


Please complete the following setup steps before the workshop. If you run into trouble with one of them, please attempt to complete the others.

  1. Install R packages
  2. Get Census API key
  3. Get Twitter credentials
  4. Get Facebook credentials


This is an approximate schedule for the day-long workshop.

8:30-9:00 Introduction
9:00-10:00 Lab: APIs
10:00-10:15 Break
10:15-11:45 Lab: Twitter
11:45-12:45 Lunch
12:45-13:30 Lab: Twitter + Visualization
13:30-14:15 Using Facebook Ads for research
14:15-14:30 Break
14:30-15:30 Lab: Facebook Ads
15:30-16:00 Discussion


The linked folders and repositories contain the code and slides for the hands-on modules.

Module 1 Retrieving data through APIs
Module 2 Collecting and analyzing Twitter data
Module 3 Visualizing and mapping Twitter data
Module 4 Demographic estimates from the Facebook Marketing API


These are additional resources you may find useful as you continue to learn about R and about digital demographic methods. R has a generous and welcoming community of users, and they have made many materials for learners available freely online.

Charles Lanfear teaches a 10-week course at the University of Washington called Introduction to R for Social Scientists. The slides and recorded videos of his lectures are publicly available on his course website:

R for Data Science is a focused and clearly-written introduction to working with R by Garrett Grolemund and Hadley Wickham. These authors have also written other books you may find helpful. The entire book is available freely at this website:

Kieran Healy's new book, Data Visualization for Social Science, introduces you to principles of good graphics and to plotting in R using ggplot2. It is available online at this website:

If you are interested in working with text data and continuing to do sentiment analysis, a helpful book is Text Mining with R, by Julia Silge and David Robinson. Their chapter on sentiment analysis describes three different common dictionaries for sentiment in English-language texts. The book is online at this website:

All of the above resources are free. We have typically found these types of resources to be more than adequate for our own learning and teaching. However, you might prefer to use more interactive or elaborate learning materials. In that case, one paid resource for learning data science in R online is DataCamp. Some university departments in the United States use their courses as additional materials for teaching students R. You can try out one of their courses, Introduction to R, for free, to see if you prefer that style of teaching and learning.

1: University of Washington