/rscala

The Scala interpreter is embedded in R and callbacks to R from the embedded interpreter are supported. Conversely, the R interpreter is embedded in Scala.

Primary LanguageR

rscala: Bi-Directional Interface Between R and Scala with Callbacks

By David B. Dahl, Brigham Young University

The rscala package provides a two-way bridge between R and Scala enabling a user to exploit each language's respective strengths in a single project. The rscala package brings Scala and Java libraries into R with a simple interface. Specifically, Scala classes can be instantiated and methods of Scala classes can be called directly. Furthermore, arbitrary Scala code can be executed on the fly from within R, inline Scala functions can be defined, and callbacks to the original R interpreter are supported. Finally, rscala also enables arbitrary R code to be embedded within a Scala or Java application. The rscala package is available on CRAN and requires no special installations or configurations of R or Scala.

Install the package in R by executing:

install.packages("rscala") 

Note that if only want to embed R in a Scala application, you don't need to install the package. Simply add the following line to the your SBT build.sbt file:

libraryDependencies += "org.ddahl" %% "rscala" % "2.4.0"

Paper:

Resources: