R-Node: a web front-end to R with Protovis

April 3, 2010
By

(This article was first published on R-statistics blog » R, and kindly contributed to R-bloggers)

Update (April 6 – 2010) : R-Node now has it’s own a website, with a dedicated google group (you can join it here)

* * * *

The integration of R into online web services is (for me) one of the more exciting prospects in R’s future. That is way I was very excited coming across Jamie Love’s recent creation: R-Node.

What is R-Node

R-Node is a (open source) web front-end to R (the statistical analysis package).

Using this front-end, you can from any web browser connect to an R instance running on a remote (or local) server, and interact with it, sending commands and receiving the responses. In particular, graphing commands such as plot() and hist() will execute in the browser, drawing the graph as an SVG image.

You can see a live demonstration of this interface by visiting:
http://69.164.204.238:2904/
And using the following user/password login info:
User: pvdemouser
Password: svL35NmPwMnt
(This link was originally posted here)

Here are some screenshots:


In the second screenshot you see the results of the R command ‘plot(x, y)’ (with the reimplementation of plot doing the actual plotting), and in the fourth screenshot you see a similar plot command along with a subsequent best fit line (data points calculated with ‘lowess()’) drawn in.

Once in, you can try out R by typing something like:

x <- rnorm(100) 
plot(x, main="Random numbers") 
l <- lowess(x) 
lines (l$y)

The plot and lines commands will bring up a graph – you can escape out of it, download the graph as a SVG file, and change the graph type (e.g. do: plot (x, type=”o”) ).
Many R commands will work, though only the hist(), plot() and lines() work for graphing.
Please don’t type the R command q() – it will quit the server, stopping it working for everyone! Also, as everyone shares the same session for now, using more unique variable name than ‘x’ and ‘l’ will help you.

Currently there is only limited error checking but the code continues to be improved and developed. You can download it from:
http://gitorious.org/r-node

How do you may imagine yourself using something like this? Feel invited to share with me and everyone else in the comments.

Here are some of the more technical details of R-Node:

How does R-Node works

(Credit: The following text is based on this forum thread)

R-node, uses protovis for drawing graphs. Protovis is a visualization toolkit written in JavaScript using the canvas element. Using simple graphical marks, like boxes and dots, one can construct custom views to present or explore data.

Besides Protovis, R-node also uses jquery and ExtJS core on the front-end.

Most R commands are passed back to the server and their results returned to the client. Some, such as the graph commands, are parsed and the arguments used in javascript re-implementations of the R commands (e.g. the R command ‘plot’ has a protovis equivalent).

The server side is R+Rserve, and to connect the browser client to the R server Jamie used a nodejs based application server.

Projects utilised in this include:

  • Protovis – http://vis.stanford.edu/protovis/
  • Nodejs – http://nodejs.org/
  • R – http://www.r-project.org/
  • Rserve – http://www.rforge.net/Rserve/doc.html
  • Shjs – http://shjs.sourceforge.net/

I would love to read your thoughts about this in the comments.

To leave a comment for the author, please follow the link and comment on his blog: R-statistics blog » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , , , , , , ,

4 Responses to R-Node: a web front-end to R with Protovis

  1. ResearchProcess (RoR Group) on April 3, 2010 at 11:17 am

    Twitter Comment


    R-Node: a web front-end to R with Protovis [link to post]

    Posted using Chat Catcher

  2. conikeec (chetan conikee) on April 3, 2010 at 11:30 pm

    Twitter Comment


    RT @alisohani: R-Node: a web front-end to R with #Protovis [link to post] @kshameer #rstats #nodejs #javascript #jquery

    Posted using Chat Catcher

  3. JQueryBot (JQuery Watcher) on April 4, 2010 at 12:02 am

    Twitter Comment


    via @paulmilford RT @alisohani: R-Node: a web front-end to R with #Protovis [link to post] @kshameer #rstats #nodejs #javascript …

    Posted using Chat Catcher

  4. alisohani (Ali Sohani) on April 4, 2010 at 12:03 am

    Twitter Comment


    R-Node: a web front-end to R with #Protovis [link to post] @kshameer #rstats #nodejs #javascript #jquery

    Posted using Chat Catcher