Packages

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
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RClient
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def eval(template: String, values: Any*): Unit
  9. def evalD0(template: String, values: Any*): Double
  10. def evalD1(template: String, values: Any*): Array[Double]
  11. def evalD2(template: String, values: Any*): Array[Array[Double]]
  12. def evalI0(template: String, values: Any*): Int
  13. def evalI1(template: String, values: Any*): Array[Int]
  14. def evalI2(template: String, values: Any*): Array[Array[Int]]
  15. def evalL0(template: String, values: Any*): Boolean
  16. def evalL1(template: String, values: Any*): Array[Boolean]
  17. def evalL2(template: String, values: Any*): Array[Array[Boolean]]
  18. def evalObject(template: String, values: Any*): RObject
  19. def evalR0(template: String, values: Any*): Byte
  20. def evalR1(template: String, values: Any*): Array[Byte]
  21. def evalR2(template: String, values: Any*): Array[Array[Byte]]
  22. def evalS0(template: String, values: Any*): String
  23. def evalS1(template: String, values: Any*): Array[String]
  24. def evalS2(template: String, values: Any*): Array[Array[String]]
  25. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  26. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. def quit(): Unit
  33. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped