For rscala developers only: Returns a value previously cached for the R interpreter.
For rscala developers only: Returns TRUE
if debugging output is enabled.
Calls eval(snippet,true)
.
Evaluates snippet
in the R interpreter.
Evaluates snippet
in the R interpreter.
Returns null
if evalOnly
. If !evalOnly
, the last result of the R expression is returned. The result is
converted if asReference
is false
and the conversion is supported, otherwise a reference is returned.
Conversion to integers, doubles, Booleans, and strings are supported, as are vectors (i.e. arrays) and matrices
(i.e. retangular arrays of arrays) of these types. The static type of the result, however, is Any
so using the
method evalXY
(where X
is I
, D
, B
, S
, or R
and Y
is 0
, 1
, or 2
) may be more convenient (e.g.
evalD0).
Calls eval(snippet,true)
and returns the result using getD0.
Calls eval(snippet,true)
and returns the result using getD1.
Calls eval(snippet,true)
and returns the result using getD2.
Calls eval(snippet,true)
and returns the result using getI0.
Calls eval(snippet,true)
and returns the result using getI1.
Calls eval(snippet,true)
and returns the result using getI2.
Calls eval(snippet,true)
and returns the result using getL0.
Calls eval(snippet,true)
and returns the result using getL1.
Calls eval(snippet,true)
and returns the result using getL2.
Calls eval(snippet,true)
and returns the result using getR0.
Calls eval(snippet,true)
and returns the result using getR1.
Calls eval(snippet,true)
and returns the result using getR2.
Calls eval(snippet,true)
and returns the result using getReference.
Calls eval(snippet,true)
and returns the result using getS0.
Calls eval(snippet,true)
and returns the result using getS1.
Calls eval(snippet,true)
and returns the result using getS2.
Closes the interface to the R interpreter.
Closes the interface to the R interpreter.
Subsequent calls to the other methods will fail.
Returns the value of identifier
in the R interpreter.
Returns the value of identifier
in the R interpreter. The static type of the result is (Any,String)
, where
the first element is the value and the second is the runtime type.
Conversion to integers, doubles, Booleans, and strings are supported, as are vectors (i.e.
arrays) and matrices (i.e. retangular arrays of arrays) of these types. Using the method getXY
(where X
is
I
, D
, B
, or S
and Y
is 0
, 1
, or 2
) may be more convenient (e.g. getD0).
Calls get(identifier,false)
and converts the result to a Double
.
Calls get(identifier,false)
and converts the result to a Double
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Double]
.
Calls get(identifier,false)
and converts the result to an Array[Double]
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Array[Double]]
.
Calls get(identifier,false)
and converts the result to an Array[Array[Double]]
.
Matrices (i.e. rectangular arrays of arrays) of integers, doubles, Booleans, and strings are supported. Integers, doubles, Booleans, and strings themselves are not supported. Vectors (i.e. arrays) of these types are also not supported.
Calls get(identifier,false)
and converts the result to an Int
.
Calls get(identifier,false)
and converts the result to an Int
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Int]
.
Calls get(identifier,false)
and converts the result to an Array[Int]
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Array[Int]]
.
Calls get(identifier,false)
and converts the result to an Array[Array[Int]]
.
Matrices (i.e. rectangular arrays of arrays) of integers, doubles, Booleans, and strings are supported. Integers, doubles, Booleans, and strings themselves are not supported. Vectors (i.e. arrays) of these types are also not supported.
Calls get(identifier,false)
and converts the result to a Boolean
.
Calls get(identifier,false)
and converts the result to a Boolean
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Boolean]
.
Calls get(identifier,false)
and converts the result to an Array[Boolean]
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Array[Boolean]]
.
Calls get(identifier,false)
and converts the result to an Array[Array[Boolean]]
.
Matrices (i.e. rectangular arrays of arrays) of integers, doubles, Booleans, and strings are supported. Integers, doubles, Booleans, and strings themselves are not supported. Vectors (i.e. arrays) of these types are also not supported.
Calls get(identifier,false)
and converts the result to a Byte
.
Calls get(identifier,false)
and converts the result to a Byte
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Byte]
.
Calls get(identifier,false)
and converts the result to an Array[Byte]
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Array[Byte]]
.
Calls get(identifier,false)
and converts the result to an Array[Array[Byte]]
.
Matrices (i.e. rectangular arrays of arrays) of integers, doubles, Booleans, and strings are supported. Integers, doubles, Booleans, and strings themselves are not supported. Vectors (i.e. arrays) of these types are also not supported.
Converts an ephemeral R reference to a persistent R reference so that it can be accessed outside of the current environment.
Obtains a persistent R reference to the named object so that it can be accessed outside of the current environment.
Calls get(identifier,false)
and converts the result to a string
.
Calls get(identifier,false)
and converts the result to a string
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[string]
.
Calls get(identifier,false)
and converts the result to an Array[string]
.
Integers, doubles, Booleans, and strings are supported. Vectors (i.e. arrays) of these types are also supported by converting the first element. Matrices (i.e. rectangular arrays of arrays) are not supported.
Calls get(identifier,false)
and converts the result to an Array[Array[string]]
.
Calls get(identifier,false)
and converts the result to an Array[Array[string]]
.
Matrices (i.e. rectangular arrays of arrays) of integers, doubles, Booleans, and strings are supported. Integers, doubles, Booleans, and strings themselves are not supported. Vectors (i.e. arrays) of these types are also not supported.
Invokes an R function with arguments.
Invokes an R function with arguments.
Invokes an R function with arguments and returns the result using getD0.
Invokes an R function with arguments and returns the result using getD0.
Invokes an R function with arguments and returns the result using getD1.
Invokes an R function with arguments and returns the result using getD1.
Invokes an R function with arguments and returns the result using getD2.
Invokes an R function with arguments and returns the result using getD2.
Invokes an R function with arguments and returns the result using getI0.
Invokes an R function with arguments and returns the result using getI0.
Invokes an R function with arguments and returns the result using getI1.
Invokes an R function with arguments and returns the result using getI1.
Invokes an R function with arguments and returns the result using getI2.
Invokes an R function with arguments and returns the result using getI2.
Invokes an R function with arguments and returns the result using getL0.
Invokes an R function with arguments and returns the result using getL0.
Invokes an R function with arguments and returns the result using getL1.
Invokes an R function with arguments and returns the result using getL1.
Invokes an R function with arguments and returns the result using getL2.
Invokes an R function with arguments and returns the result using getL2.
Invokes an R function with arguments and returns the result using getR0.
Invokes an R function with arguments and returns the result using getR0.
Invokes an R function with arguments and returns the result using getR1.
Invokes an R function with arguments and returns the result using getR1.
Invokes an R function with arguments and returns the result using getR2.
Invokes an R function with arguments and returns the result using getR2.
Invokes an R function with arguments and returns the result using getReference.
Invokes an R function with arguments and returns the result using getReference.
Invokes an R function with arguments and returns the result using getS0.
Invokes an R function with arguments and returns the result using getS0.
Invokes an R function with arguments and returns the result using getS1.
Invokes an R function with arguments and returns the result using getS1.
Invokes an R function with arguments and returns the result using getS2.
Invokes an R function with arguments and returns the result using getS2.
Pings the R interpreter.
Pings the R interpreter.
Calling this method periodically on an otherwise-idle client may prevent the operating system from closing the socket.
Returns true
if the ping is successful and false
otherwise.
A short-hand way to call get.
A short-hand way to call get.
R eval """ a <- numeric(10) for ( i in 2:length(a) ) { a[i] <- 0.5*a[i-1] + rnorm(1) } """ R.a
Assigns value
to a variable identifier
in the R interpreter.
Assigns value
to a variable identifier
in the R interpreter.
Integers, doubles, Booleans, and strings are supported, as are vectors (i.e. arrays) and matrices (i.e. retangular arrays of arrays) of these types.
If index != ""
, assigned into elements of identifier
are performed by using either single brackets
(singleBrackets=true
) or double brackets (singleBrackets=false
).
R.a = Array(5,6,4) R.eval("b <- matrix(NA,nrow=3,ncol=2)") for ( i <- 0 until 3 ) { R.set("b",Array(2*i,2*i+1),s"${i+1},") } R.b R.eval("myList <- list()") R.set("myList",Array("David","Grace","Susan"),"'names'",false) R.set("myList",Array(5,4,5),"'counts'",false) R.eval("print(myList)")
Equivalent to calling set(identifier, value, "", true)
.
A short-hand way to call set(identifier,value)
A short-hand way to call set(identifier,value)
R.b = Array.fill(10) { scala.math.random }
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.