package rscala
- Alphabetic
- Public
- All
Type Members
-
class
EphemeralReference extends Reference
A reference to an R object which is only guaranteed to be valid in the scope in which it was created.
-
class
PersistentReference extends Reference
A reference to an R object which persists beyond the scope in which it was created.
-
class
RClient extends Dynamic
An interface to an R interpreter.
An interface to an R interpreter.
An object
R
is the instance of this class available in a Scala interpreter created by calling the functionscala
from the package rscala. It is through this instanceR
that callbacks to the original R interpreter are possible.In a Scala application, an instance of this class is created using its companion object. See below. The paths of the rscala's JARs (for all supported versions of Scala) are available from R using
rscala::.rscalaJar()
. To get just the JAR for Scala 2.12, for example, userscala::.rscalaJar("2.12")
.This class is threadsafe.
val R = org.ddahl.rscala.RClient() val a = R.evalD0("rnorm(8)") val b = R.evalD1("rnorm(8)") val c = R.evalD2("matrix(rnorm(8),nrow=4)") R.set("ages", Array(4,2,7,9)) R.ages = Array(4,2,7,9) println(R.getI1("ages").mkString("<",", ",">")) R eval """ v <- rbinom(8,size=10,prob=0.4) m <- matrix(v,nrow=4) """ val v1 = R.get("v") val v2 = R.get("v")._1.asInstanceOf[Array[Int]] // This works, but is not very convenient val v3 = R.v._1.asInstanceOf[Array[Int]] // Slightly better val v4 = R.getI0("v") // Get the first element of R's "v" as a Int val v5 = R.getI1("v") // Get R's "v" as an Array[Int] val v6 = R.getI2("m") // Get R's "m" as an Array[Array[Int]]
-
sealed
trait
Reference extends AnyRef
A reference to an R object.
Value Members
-
object
EphemeralReference
A reference to an R object which is only guaranteed to be valid in the scope in which it was created.
-
object
PersistentReference
A reference to an R object which persists beyond the scope in which it was created.
-
object
RClient
The companion object to the RClient class used to create an instance of the RClient class in a Scala application.
The companion object to the RClient class used to create an instance of the RClient class in a Scala application.
An object
R
is an RClient instance available in a Scala interpreter created by calling the functionscala
from the package rscala. It is through this instanceR
that callbacks to the original R interpreter are possible.The paths of the rscala's JARs are available from R using
rscala::.rscalaJar()
. To get just the JAR for Scala 2.12, for example, userscala::.rscalaJar("2.12")
.val R = org.ddahl.rscala.RClient()