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

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.

0 thoughts on “R-Node: a web front-end to R with Protovis”

  1. Hi there,

    Thanks for the mention! R-Node is still pretty alpha-material, so I can’t guarantee the quality of the demo for a bit.

    Anyway, I fixed a bug that was stopping the access working (looking for ExtJS in the wrong place), so go ahead and try out the link now.

  2. At moment i do the implementation (REST paradigm) of Web Service for Forecasting of Stocks volatility (on the fly) on the base R Server + Protovis + Node js + UI with backbone js + Mongoose ( on the platform AWS (EC2))
    and would like to add the implementation of QuantLib as a service and i am looking for developers or solutions for implementation a JavaScript port of QuantLib that could run either on the client or on the server (using like Node.js)

    You wrote 1 year ago: ” I know quite a few people who would be interested by this ( means JavaScript port of QuantLib). If not, what would be the best way to approach such a project ”

    Question: “Can you inform me the contacts of people how was it said above ”

    Thanks,

    Alexander
    Email: forecasting (at) gmx de

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.