[Rd] Passing R code from webpage

Mike Marchywka marchywka at hotmail.com
Sun Feb 17 15:29:16 CET 2013






----------------------------------------
> From: simon.urbanek at r-project.org
> Date: Sun, 17 Feb 2013 09:16:57 -0500
> To: matevzpavlic at gmail.com
> CC: r-devel at r-project.org
> Subject: Re: [Rd] Passing R code from webpage
>
> On Feb 16, 2013, at 6:48 PM, Matevz Pavlic wrote:
>
> > Hi all,
> >
> > Is there a way to pass R code from web page (html file) to do some
> > statistics and than plot the output in web browser.
> >
> > I am looking forever at this, and cant find a way.
> >
>
> Typically this is done by sending an AJAX request to R and display the result (or simple forms if you want to). I use FastRWeb for this - it even has an example on how you create plots and other output. There is also rApache if you are using apache web server.

Depending on how you want to use it, as others have suggested, there are a lot of approaches. Invoking an "R" process is a bit expensive and
having a single R server available is much more efficient however for what we were doing the bigger gain was from caching results. That is,
we have maps by area, say state or zip code, where we can tolerate results a few minutes old. So, we used a custom java server to
invoke R as part of a general ability to execute bash scripts and then buffer the resulting images in memory. This approach worked well
but did potentially require starting a new Rprocess for each request. I had always wanted to make use of shared R instances but never
got around to doing this as the scaling never became relevant. 

Our interface was something simple, like "http://host/Rscriptname?zip=00000&otherkeys=value"

which would return an result with appropriate mime type to keep browser happy and have it fit on page ok etc.

The point is that  anything that can invoke a bash script can invoke R and if  you are concerned about doing this efficiently it is not hard to write a simple java app that listens on a port and can invoke
R and then do caching to meet your needs if apache etc does not do this easily. 







>
> Cheers,
> Simon
>
>
> > Regards,m
> >
> >
> >
> > --
> > View this message in context: http://r.789695.n4.nabble.com/Passing-R-code-from-webpage-tp4658800.html
> > Sent from the R devel mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
 		 	   		  


More information about the R-devel mailing list