How to Analyze Typeform Responses Using R
This article is originally published at https://blog.datazar.com/tagged/r-language?source=rss----e2c7e6e1c75--r_language
How to Retrieve and Analyze Typeform Responses in Real-Time Using R and Webhooks

Typeform is a great data-collection tool that makes is very easy to collect responses from people you send it out to. You can use it to survey people, create applications/forms for programs, RSVP forms for events etc…
There’s several ways you can extract these responses from Typeform, one of them being through their Webhooks. You can also download the responses in CSV or XLSX but using webhooks allows you to gather the responses in real-time versus waiting for all responses to be submitted or downloading portions of the data every arbitrary time-period.
In addition to having the responses in real-time, webhooks also allow you to create real-time charts and dashboards that you can track.
In this article, we’ll create a simple Typeform…form?, use webhooks to extract the responses and load them into an R notebook. The responses come in JSON format over the API so we’ll need the rjson library/package from R.
1. Creating the Form
Once you’ve created your Typeform account (it’s free), your dashboard will have a couple buttons where you can create a new form. Create the type form and in the “blocks” section to the left, create “Short Text” field as an example. There’s several options but this will allow us to create a very simple, one-field form. Type in the question/label you want for the field.

2. Preparing the Dataset
On Datazar, create a project if you haven’t and create an empty JSON dataset like so.


Click on the “Datasets” button and select JSON. Save this dataset and create a webhook link for it.

Click on the menu button (three dots) for the file and select “Webhooks”. Once you’ve created the webhook link, copy it. We’re going to save in Typeform’s “Connect” section.
Ok back on Typeform, go to the “Connect” section of the page and then “Webhooks”. The “Webhooks” section is located next to the “Integrations” section. Don’t forget to activate webhooks on Typeform by clicking on the switch. It should turn to green. Paste the webhook link you got from Datazar and hit “Test Webhook”.

This will send an example payload to your dataset. Refresh you Datazar file page and you’ll see there’s payload in your new JSON dataset.

Ok if you don’t see anything in the JSON file, go back and check that everything is set. Check that you have activated webhook on Typeform and check that the webhook link you copied from Datazar is exactly the same as the one you pasted in Typeform.
3. Collecting Responses
Now that we’ve tested the connection, let’s start sending responses. Go to the “Share” section in Typeform and copy the link to your form. Paste it in a new tab on your browser and test it out.

You should see new the responses in your JSON dataset.
4. Using R to Access the Response Data
Create an R Notebook by going back to the “Toolkit” section on your Datazar project.



Now load the responses dataset by clicking on the “Load Files” button. This creates a snapshot of the dataset with the responses. This prevents you from tampering with the dataset so that you don’t change/corrupt it from R and allows you to work with a particular version of the dataset so that your results don’t get skewed by new responses.

Once you’ve loaded the dataset, the button will turn green and now you’re ready to import it to a variable on R.
In the first cell, we included the package rjson and then imported it using the fromJSON function. From here you can do whatever you want with the data.

Resources
Here are some resources, including the example project.
- How to Analyze Typeform Responses Using R - Datazar
- CRAN - Package rjson
- Turn data collection into an experience | Typeform
How to Analyze Typeform Responses Using R was originally published in Datazar Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.
Thanks for visiting r-craft.org
This article is originally published at https://blog.datazar.com/tagged/r-language?source=rss----e2c7e6e1c75--r_language
Please visit source website for post related comments.