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.2.2"
Paper:
- Paper submitted to Journal of Statistical Software. Note the paper pertains to version 1.0.6 of the package.
- Code for all examples in paper.
- Temperatures webapp from Section 5.2 from the paper.
Resources:
- Git repository containing source code and build & test scripts.
- Package on Comprehensive R Archive Network (CRAN).
- Scaladoc for embedding R in Scala.
- Javadoc for embedding R in Java.