Class/Object

org.ddahl.rscala

RClient

Related Docs: object RClient | package rscala

Permalink

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def eval(template: String, values: Any*): Unit

    Permalink
  9. def evalD0(template: String, values: Any*): Double

    Permalink
  10. def evalD1(template: String, values: Any*): Array[Double]

    Permalink
  11. def evalD2(template: String, values: Any*): Array[Array[Double]]

    Permalink
  12. def evalI0(template: String, values: Any*): Int

    Permalink
  13. def evalI1(template: String, values: Any*): Array[Int]

    Permalink
  14. def evalI2(template: String, values: Any*): Array[Array[Int]]

    Permalink
  15. def evalL0(template: String, values: Any*): Boolean

    Permalink
  16. def evalL1(template: String, values: Any*): Array[Boolean]

    Permalink
  17. def evalL2(template: String, values: Any*): Array[Array[Boolean]]

    Permalink
  18. def evalObject(template: String, values: Any*): RObject

    Permalink
  19. def evalR0(template: String, values: Any*): Byte

    Permalink
  20. def evalR1(template: String, values: Any*): Array[Byte]

    Permalink
  21. def evalR2(template: String, values: Any*): Array[Array[Byte]]

    Permalink
  22. def evalS0(template: String, values: Any*): String

    Permalink
  23. def evalS1(template: String, values: Any*): Array[String]

    Permalink
  24. def evalS2(template: String, values: Any*): Array[Array[String]]

    Permalink
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  26. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  30. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  31. def quit(): Unit

    Permalink
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  33. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped