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

**R-statistics blog » R**, 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.

**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 – https://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.

**leave a comment**for the author, please follow the link and comment on their blog:

**R-statistics blog » R**.

R-bloggers.com 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.