Statistically programming the web – Shiny,HttR and RevoDeploy API

Ajay Ohri, November 19th, 2012

For statisticians trying to use the internet as a source of data, the Internet creates a unique dilemma . Statisticians don’t really get web programming and web programmers don’t really get statistics.

The most popular statistical language like R have extensive packages for XML, JSON and HTTP requests using CURL, yet when it comes to APIs the statistical languages make it tough to work with especially with the spread and the dissonance of their design with the OAuth authentication protocols.

Uptil now the workaround was to use Python to get the data and then pass the data to R using the bridge package Rpy.

However Hadley Wickham ,creator of the now legendary ggplot package, has released an upgrade to his httr package that makes it easier to use  for APIs. The package httr provides Tools for working with URLs and HTTP. Actually httr is a simplified wrapper built on top of RCurl. It is much much less configurable but because it only attempts to encompass the most common operations it is also much much simpler.

Httr provides:

  • functions for the most important http verbs: GET, HEAD, PATCH, PUT, DELETE and POST.
  • automatic cookie handing across requests, connection sharing, and standard SSL config.
  • a request object which captures the body of the request along with request status, cookies, headers, timings and other useful information.
  • easy ways to access the response as a raw vector, a character vector, or parsed into an R object (for html, xml, json, png and jpeg).

The upgrade was announced on the Rstudio Blog.The demos directory has six demos of using OAuth: three for 1.0 (linkedin, twitter and vimeo) and three for 2.0 (facebook, github, google). You can track httr’s development on github,

In addition to this statistical programming the web has a new weapon called Shiny that makes it easier  to deploy web applications with built in statistical functionality. Shiny has been launched for public beta testing by RStudio as well:

“Shiny makes it super simple for R users to turn analyses into interactive web applications that anyone can use. These applications let you specify input parameters using friendly controls like sliders, drop-downs, and text fields; and they can easily incorporate any number of outputs like plots, tables, and summaries.”


Now webs services for R have been around for two years thanks to the pioneering work of Revolution Analytics, and the product is known as RevoDeployR.

RevoDeployR is a Web Services framework built on Revolution R Enterprise Server to support production applications of R. The RevoDeployR API supports the integration of R-based analytics into Web, desktop and mobile applications. The standards-based API is exposed by the RevoDeployR server, an enterprise server technology capable of scaling to meet the needs of highly intensive, highly trafficked R-enabled applications.

However Shiny is both free and open source and is aimed at making things simpler for people to use the web for programming. Combine httr package with Shiny, and you get a formidable toolkits to unleash analytical mashups that make it easier to both create much better graphics than Python, and does away with the need to learn Javascript or HTML for making web applications.

Statistical web applications on the internet- now just one more API call away!

Both comments and pings are currently closed.

Comments are closed.

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.