I was wondering if anyone possibly had any experience integrating R into Rails, specifically, on heroku. I am familiar with the rsruby gem, which is the de facto (perhaps only) binding that ruby has with R, but documentation on integrating R with Rails is sparse if not nonexistent. Would it be feasible to, let's say, install R into the lib folder of a Rails application and use rsruby to access it through Rails?
I use Rserve with a wrapper which simplifies the interface, called Rserve-simpler.
http://rubygems.org/gems/rserve-simpler . It makes my life easier. I end up using R and Ruby together quite often.
Here is a question where I've explained some usage. How to pass a ts object to R via RSRuby
I created a Heroku Buildpack to make using R on Heroku a no-brainer.
Checkout the heroku-buildpack-r for details.
I explored R/Rails integration a couple of years ago, so my posts will be out of date by now. However, they're still available and might be useful if you want to read them:
RSRuby and Rails revisited.
One issue I encountered was a "stack smashing error" on terminating the development server, which made me nervous as to whether the project was worth pursuing.
I have not tried deployment to Heroku. In principle, I like your idea of putting R in the Rails lib/, but I'm not sure if it would work.
In general, I find that bridging other languages with R is troublesome. It might be better to keep the two separate, by running R on a server (using e.g. RApache) and passing data back/forth between that and the Rails app (e.g. as JSON). Another post that I wrote on that idea:
Getting your web application and R(Apache) to talk to each other
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With