[R] export R data as web service

Johann Hibschman jhibschman at gmail.com
Thu Apr 1 16:37:51 CEST 2010


I'd like to access data in my R session from elsewhere via HTTP.  My
particular use case would be R on Linux, accessing data from Windows,
all on the same intranet.

Naively, when I say this, I imagine something like:

> theData <- big.calculation.returning.data.frame()
> startHttpServer(port=8675)
(blocks until I C-c it)

Elsewhere...

  http://linuxmachine:8675/htmlDF?theData
    -> HTML table version of data frame

or

  http://linuxmachine:8675/csvDF?theData
    -> CSV export of data frame

Then I C-c my server and continue working in R.

Rserve has its own protocol, plus it spawns extra processes.  biocep
looks interesting, but it's far more ambitious than this, and I can't
tell if it would actually work in this case.  svSocket looks
interesting, but (if I understand it correctly) it would be a lot of
work to implement HTTP over its raw sockets.

Basically, I have a few tools (including Excel) that know how to get
data from web services, but no way to export data from R in a way that
they can see.  I'm spoiled a little by having used q (from kx.com),
which embeds a HTTP server in the interpreter and makes this kind of
access very easy; I'd like to have the same thing in R.

Thanks,

- Johann



More information about the R-help mailing list