R Monkey Business

R Monkey Business

One reason R is useful and continues to grow in popularity: there are thousands of packages to accomplish specific tasks--7000 and counting as of 5 September 2015. If you have a problem or project, chances are somebody, somewhere, has built an R package to make your work easier. Sometimes, the package doesn’t work exactly right but the R ecology helps you figure out what to do.

Project Background

In my work with The Conversation Project , we’ve already built a Shiny app that allows TCP staff to view run charts of visitor counts and kit downloads. The Shiny app interacts with the Google API via the package RgoogleAnalytics to get the numbers for the displays.

Now TCP staff are considering how to help a network of local champions, who conduct workshops and point people to TCP materials. The local folks and TCP (as well as funders) want to assess the impact of their outreach. TCP  uses SurveyMonkey to ask basic impact questions for its “in-house” sponsored workshops. Can we extend use of SurveyMonkey to the network?

Thinking about network interest in follow-up surveys, we may need to generate dozens of surveys every month. Manual survey creation and analysis implies multiple emails, downloading unfriendly data files, cutting and pasting into Excel, etc. Ugly.

Given that we had success in connecting with Google Analytics API via R, what about a package to interact with the SurveyMonkey API?

Using the Rmonkey Package

A guick Google search led me to the Rmonkey package, developed by Tom Leeper. Like many package developers, Tom has his package on GitHub, which makes the most recent versions of the code available. GitHub also provides methods to pose questions and suggest changes. GitHub is a key component of the R ecology, facilitating exchange among developers and contributing to maintenance of open-source packages.

After installing the Rmonkey package, I hit the wall with a not very clear error message in an attempt to create new survey using the createsurvey function. Access to the Tom’s code allowed me to find the bug, despite having no initial knowledge of JSON, the scripting language used to interact with the SurveyMonkey API.

I posted my proposed changes to createsurvey to GitHub via a “pull request” so Tom can consider my suggestions; in the mean time, I have a local version of Tom’s createsurvey function that correctly interacts with the SurveyMonkey API to create new surveys. We are on our way to building a method to automate creation and analysis of TCP event surveys.

I will present the details of the detective work at the Madison R UseR’s Group, 16 September 2015. A pdf of the slide deck is available here.

Behavioral Science problem-solving in the U.S. Government

Behavioral Science problem-solving in the U.S. Government

In planning and design problems, how much testing should you do?

In planning and design problems, how much testing should you do?