package rscala
Ordering
- Alphabetic
Visibility
- Public
- Protected
Type Members
- class RClient extends AnyRef
A bridge to R.
A bridge to R.
In a Scala application, an instance of this class is created using its companion object as shown below.
In an R script, the object
R
is an instance of this class available in an rscala bridge created by calling the functionscala
from the package rscala. It is through this instance that callbacks to the original R interpreter are possible.All of the evaluation methods of this class have the same signature. The first argument is a template for an R expression, where
%-
is a placeholder for items that are provided as variable arguments. The result type is indicated by the suffix of the method name. See examples below.This class is threadsafe.
val R = org.ddahl.rscala.RClient() val a = R.evalD0("sd(rnorm(1000, mean=%-, sd=%-))", 1.0, 2.0) R.eval("primes <- %-", Array(2, 3, 5, 7, 11, 13, 17, 19, 23)) val rFunction = R.evalObject("function(x) x*primes") val primesTimesTwo = R.evalI1("%-(2)", rFunction) val m = R.evalI2("matrix(rbinom(%-, size=10, prob=0.5), nrow=2)", 8) R.quit()
- final class RObject extends AnyRef