• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Embedding R in other Applications

 
author
Posts: 33
5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although not asked directly, there seems to be an implicit thread around how to embed R in other applications.

There are a large number of entry points in the R executable/DLL that can be called from C. See Writing R Extensions for details on the R API, as well as details for linking GUIs and other front-ends to R.

The RInside package provides C++ classes that facilitate embedding R functionality in C++ code on Linux, OS X, and Windows. An excellent blog on the subject can be found here.

Rserve is a "a TCP/IP server which allows other programs to use facilities of R from various languages without the need to initialize R or link against R library. Every connection has a separate workspace and working directory. Client-side implementations are available for popular languages such as C/C++, PHP and Java. Rserve supports remote connection, authentication and file transfer. Typical use is to integrate R backend for computation of statstical models, plots etc. in other applications."

There are many examples of calling R from Java, including rJava and RCaller.

There are numerous Web based inferfaces to R that take submitted code, runs R on the code (batch mode), and returns text and graphical output as web pages. See Rweb for an example.

I hope this helps.

Rob
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for posting that, I was kind of trying to figure that out by asking if it was a JVM language.

It looks like rJava/RCaller are the things to look at for those of us in Javaland.

RCaller looks very simple to use, however one nice thing about JVM languages is their ability to call into existing Java libraries. Just by reading a bit about rJava it looks like it has a way to call from R->Java which can be very convenient for database drivers and libraries to things like data grids.
 
Greenhorn
Posts: 18
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Robert for this info.

I think most of us were wondering this issue, I mean, how to use R as a back-end for end-user applications written in other languages. As you may noticed from the thread about data mining and adaptive web, I was asking about this issue because one of the main use enterprises (e-commerce and e-learning) could take of a statistical language is to help them build web applications that can be automatically customized by customer preferences, customer web usages etc, i.e. the statistical language should act as a back-end for data/web mining processing to inform the application business logic on how to build user interfaces (based upon those data mining results).

I think R could have a great success in this role if projects as rJava could be properly addressed to be fully integrated with any of the popular j2ee frameworks.

Thank you again for your comments
 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RCaller is great. I would definitely recommend using it to call R from Java as long as you realize that under the hood it is just calling RScript from the command line. But the API is wrapped in such a way that the calling code shouldn't care.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic