Monthly Archives: November 2009

A brief survey of R web interfaces

I’m looking at ways to provide access to R via a web application. First rule: see what’s available first, before you reinvent the wheel. It’s not pretty.

From the R Web Interfaces FAQ:

Software Brief notes
Rweb Page last updated 1999. Of the 3 example links on the page one ran very slowly, the second not at all and the third is broken.
R-Online Or rather, not online. Unless this CGI form is the same thing. I tried Example 1, it returned a server error.
Rcgi Links to several CGI forms, none of which worked for me.
CGI-based R access Link did not load.
CGIwithR Package now maintained at Omegahat. Did not attempt installation. Last updated 2005.
Rpad I could not connect to this URL.
RApache The pick of the bunch. Provides server-side access to R through an Apache module. I was able to install RApache on 32-bit (but not 64-bit) Ubuntu 9.10 and get it running. Could use more documentation.
Rserve Serves R via TCP/IP. Last updated 2006.
OpenStatServer Broken link. No longer exists, so far as I can tell.
R PHP Online Link out of date (but you can follow it to the newer page). Last updated 2003, so unlikely to be much use.
R-php Last updated 2006; the example that I tried gave a server error.
webbioc A Bioconductor package. Did not investigate further.
Rwui An application to create R web interfaces. My browser hung at “waiting for cache”. I gave up.

So, aside from RApache and some very old-fashioned and/or broken CGI scripts, I conclude that there is little interest in writing beautiful, modern statistical web applications (notable exception). Not so much a case of “reinventing” as “inventing”.

Turn Emacs into an IDE

Update: I should have said Rails IDE – but I’m sure similar plugins are available for other languages

I fired up NetBeans at work today, tried to open a Rails project and – inexplicably, it crashed. All is well at home, so I’m blaming work machine setup issues as-yet unknown (but I suspect, involving the letters “ATI”).

It got me thinking that, as much as I like NetBeans, it is still just a memory-eating, CPU-hogging, bloated Java-based GUI. For some time I’ve wanted to convert my favourite editor, Emacs, to something more like an IDE.

emacs23_rails_ide

It's Emacs, but not as we know it


The WyeWorks Blog to the rescue. Install emacs-23 and a couple of Ruby gems, clone their github repository of Emacs plugins, copy to your ~/.emacs.d/ and voilĂ  – marvel at your new, shiny editing environment. I also replaced my ~/.emacs with their init.el file.

The key plugins include ECB, textmate.el, Rinari and yasnippet, plus a bunch of modes for syntax highlighting. If you’ve only tried cursory Emacs customisation in the past the results are a little alarming at first, but you’ll be back to coding (and saying “Ooh! Aah!”) in no time at all.

R has a JSON package

Named rjson, appropriately. It’s quite basic just now, but contains methods for interconversion between R objects and JSON. Something like this:

library(rjson)
data <- list(a=1,b=2,c=3)
json <- toJSON(data)
json
[1] "{\"a\":1,\"b\":2,\"c\":3}"
cat(json, file="data.json")

Use cases? I wonder if RApache could be used to build an API that serves R data in JSON format?

Brief notes on Ubuntu 9.04 (jaunty) -> 9.10 (karmic)

Recording my Ubuntu upgrade experience has become something of a tradition, so here goes.

  • Machine 1 (laptop, LG T1 Express Duo). Largely trouble-free. On-board soundcard not seen on reboot. Fixed (temporarily, lost on reboot) using “sudo alsa force-reload”.
  • Machine 2 (various generic hardware, cobbled together over many years). Upgrade smooth until final restart, when machine froze. Rebooted to a blank screen. Fixed by swapping out ATI video card for old NVidia FX5200. Discovered that rsyslog is running riot due to a hot CPU and is trying to fill up /var/log.
  • Machine 3 (Dell Optiplex GX550). Install froze at “stopping winbind server”. Rebooted with rescue CD, mounted and chroot-ed into Linux partition, tried “dpkg –force-all –configure -a”, but to no avail. Reinstalled in same partition, all is working well.

All in all, not very impressed. Canonical, could do better.