class RClient extends AnyRef
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 function
scala
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()
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- RClient
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def eval(template: String, values: Any*): Unit
- def evalD0(template: String, values: Any*): Double
- def evalD1(template: String, values: Any*): Array[Double]
- def evalD2(template: String, values: Any*): Array[Array[Double]]
- def evalI0(template: String, values: Any*): Int
- def evalI1(template: String, values: Any*): Array[Int]
- def evalI2(template: String, values: Any*): Array[Array[Int]]
- def evalL0(template: String, values: Any*): Boolean
- def evalL1(template: String, values: Any*): Array[Boolean]
- def evalL2(template: String, values: Any*): Array[Array[Boolean]]
- def evalObject(template: String, values: Any*): RObject
- def evalR0(template: String, values: Any*): Byte
- def evalR1(template: String, values: Any*): Array[Byte]
- def evalR2(template: String, values: Any*): Array[Array[Byte]]
- def evalS0(template: String, values: Any*): String
- def evalS1(template: String, values: Any*): Array[String]
- def evalS2(template: String, values: Any*): Array[Array[String]]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def quit(): Unit
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.