How to tidy select all that apply questions in R

Surveys often have multiple choice, select all that apply questions. Being able to wrangle this type of data in R can be challenging. Figuring out the right way to get your data into the (tidy) structure necessary for visualizing it with ggplot can be complicated. And, to make things even more complicated, different survey tools spit out data from select all that apply questions in different formats.

This blogpost is going to demonstrate how we would use tidy data principles and the tidyverse to wrangle data from a variety of different survey tools. The data was initially gathered by me tweeting a link to the exact same survey in Google Forms, Qualtrics and Survey Monkey.

The survey contained just one question that looks like this:

The data that came out looks different for each tool.

Google Forms has the data in a single column, with responses separated by commas.

Survey Monkey creates one column for each potential response (and an additional column for “other

Qualtrics creates one column for all responses in the select all that apply list of options and a separate column for “other” responses.

No matter how the data comes in, we ultimately want it in a tidy format like this:

Note that each response is on its own row, following the tidy data principles:

  1. Every column is a variable.
  2. Every row is an observation.
  3. Every cell is a single value.

How do we get our data into this format? Let’s dive in!

Google Forms

Google Forms is the survey tool we usually choose as the forms look good and we can read the responses into R via the excellent {googlesheets4} package. To make things simpler, you can download the results as an Excel file.

It’s actually fairly pleasant to work with Google Forms survey data, as I demonstrate in this video. I’ve also provided a tidied up version of the code below.

Survey Monkey

Survey Monkey no longer has a free tier that allows you to download data from the service. There is an experimental package {surveymonkey} for directly downloading data from your account, but I haven’t experimented with it.

The export format of Survey Monkey splits headers across multiple rows, which the {readxl} package on its own isn’t designed to deal with. However, the awesome {unheadr} package allows us to mash together column names across multiple rows.

As I show in the video, once we’ve used {unheadr} to tidy up the columns the next step is to convert the data from wide to long with pivot_longer().


There is a great package called {qualtRics} for programmatically downloading survey data from Qualtrics. Unfortunately, you do have to have a paid Qualtrics account.

I actually really appreciate the data format that Qualtrics uses, each question has two columns: one for the fixed responses and the other column contains write in values. As I demonstrate in the video below we can use separate_rows() to convert observations into a long, tidy dataset.

Want articles like this in your email? Sign up for the R for the Rest of Us newsletter.

Have any questions? Put them below. David or Charlie Hadley will help you out!