Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using R from Scala and invoking Scala from R?

Tags:

r

scala

Do you know something about possibilites of

  • invoking Scala from R and
  • using R (libraries) from within Scala?

Best regards

Raffael

like image 224
Raffael Avatar asked Feb 06 '11 16:02

Raffael


2 Answers

Check out the jvmr package in R available on CRAN. It allows you to:

  1. embed the R interpreter in Scala
  2. embed the Scala interpreter/compiler in R.

It also allows you to do the same with Java. An article describing its usage is here. (Disclosure: I'm the author.)

like image 96
David B. Dahl Avatar answered Oct 19 '22 22:10

David B. Dahl


There is an R package on CRAN for exactly this purpose, called "rscala". It allows bi-directional calling (R from Scala and Scala from R), as well as callbacks (eg. calling back to R from Scala code called from R). It is well documented. This package replaces the "jvmr" package mentioned in another answer.

like image 21
Darren Wilkinson Avatar answered Oct 20 '22 00:10

Darren Wilkinson