Do you want to use R to tell stories? This book was written for you—whether you already know some R or have never coded before.

Most R texts focus only on programming or statistical theory. Practical R for Mass Communication and Journalism gives you ideas, tools, and techniques for incorporating data and visualizations into your narratives.

You’ll see step by step how to:

  • Analyze airport flight delays, restaurant inspections, and election results

  • Map bank locations, median incomes, and new voting districts
  • Compare campaign contributions to final election results
  • Extract data from PDFs
  • Whip messy data into shape for analysis
  • Scrape data from a website
  • Create graphics ranging from simple, static charts to interactive visualizations for the Web

If you work or plan to work in a newsroom, government office, non-profit policy organization, or PR office, Practical R for Mass Communication and Journalism will help you use R in your world.

This book has a companion website with code, links to additional resources, and searchable tables by function and task.

Sharon Machlis is the author of Computerworld’s Beginner’s Guide to R, host of InfoWorld’s Do More With R video screencast series, admin for the R for Journalists Google Group, and is well known among Twitter users who follow the #rstats hashtag. She is Director of Editorial Data and Analytics at IDG Communications (parent company of Computerworld, InfoWorld, PC World and Macworld, among others) and a frequent speaker at data journalism and R conferences.


chapter 1|4 pages


chapter 2|10 pages

Get Started With R in a Few Easy Steps

chapter 4|14 pages

Import Data into R

chapter 5|10 pages

Basic Data Exploration

chapter 6|28 pages

Beginning data visualization

chapter 7|8 pages

Two or more data sets

chapter 8|12 pages

Analyze data by groups

chapter 9|14 pages

Graphing by Group

chapter 10|12 pages

Write your own R functions

chapter 11|28 pages

Maps in R

chapter 12|20 pages

Putting it all Together: R on Election Day

chapter 13|8 pages

Date calculations

chapter 14|12 pages

Help! My data’s in the wrong format!

chapter 16|6 pages

Simple Web scraping

chapter 17|12 pages

An R project from start to finish

chapter 18|4 pages

Additional resources