googleformr at Work: Pneumatic Road Tube Allegory

[This article was first published on R – TRinker's R Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Steve Simpson (@data_steve) created the googleformr package to enable users to easily send information to a Google Form.  It’s a nice way to send and securely store data via R and the price is great…FREE!

A Pneumatic Road Tube Allegory…Kinda

My team has been working on a data validation task at work and we’ve built a couple of  internal packages & scripts to help us with the task.  We’ve set it up so non-technical colleagues can use the packages and scripts as automated .bat/.sh files.

After a few months we wanted to make improvements but had no evidence of what packages and scripts were used most often, what parts were worth the additional development time.  What we needed was something like those strips used on streets to determine traffic flow and usage.  Turns out those strips are called pneumatic road tubes in case you ever get that as a Jeopardy question.  They provide a safe, low cost, and simple way to collect information.  Exactly what we needed just a code based version…


But, like most CRAN mirrors, we have had no way of even knowing when a package is downloaded let alone who’s using the package & scripts and how often.  But once googleformr was released that changed.

Our initial phase was just to see who was using the packages/scripts and when.  All that was required to answer this question was (A) making a Google Form with a single text box and then (B) adding a couple of lines of code from googleformr to send a unique identifier to a google form (which can be set up to go to a Google Spreadsheet).  A little help from Jenny Bryan’s googlesheets package with some Hadley ggplot2 love and we had the following image showing employee usage of a particular script for the first several weeks.

I bet you’re asking, “How’d we do it?” Well…  See the explanation and mock code below to make your own code based pneumatic road tube.


Step 1: Get googleformr

Getting googleformr is simple.  This simple chunk should have you up and running with googleformr in a jiffy (do people still say jiffy?):

if (!require("pacman")) install.packages("pacman")

Step 2: Make a Google Form

Then make a Google Form with a text entry.  Here’s an image showing the steps to link the form to a spreadsheet. In the Google Form edit: 1) Click Responses Tab 2) Click those three dot thing-ies 3) Click “Select response destination” 4) click “Create a new spreadsheet”  Step 1 done.  Almost there…


In this image we see the Google Form and the accompanying Google Sheet.


Step 3: Send Information Via googleformr

Just use the gformr function, add the Google Form url (from Step 1) and viola you have  a function that allows you to send information to a Google Form (in this case I made a ping function).  This is the function we can use to send information about the package and script usage within our company.

ping <- googleformr::gformr('')

You’re in business with a secure way to send data from R to Google Spreadsheet.

Go ahead try it.  Replace ’employee1234′ with whatever you want, go to the Google Sheet, and watch the R code you send auto-magically be sent to the spreadsheet. I’ve made this sheet public for demonstration purposes, but generally it’s recommended that you keep the sheets private.

With this simple code snippet placed in the internal scripts and packages we were able to determine what packages and scripts were used, by whom, and how frequently.  So far our pneumatic road tube code  has provided insight into what tools to improve and new features to consider.  And it only took 5 minutes to set up end to end.


We’re just getting started with the information we collect to make our internal R tools better.  I think that googleformr is an interesting package with a ton of potential for securely sending information for free.  I’d love to hear about your ideas on how to use it via the comments below.

To leave a comment for the author, please follow the link and comment on their blog: R – TRinker's R Blog. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)