scala | R Documentation |
This function creates an instance of a Scala bridge. Details on this function (and the rscala package as a whole) are provided in the package vignette. The original paper was published in the Journal of Statistical Software. See the reference below.
scala(
JARs = character(),
serialize.output = .Platform$OS.type == "windows",
stdout = TRUE,
stderr = TRUE,
port = 0L,
heap.maximum = NULL,
command.line.arguments = character(0),
debug = FALSE
)
JARs |
Character vector describing JAR files to include in the classpath. Elements are some combination of file paths to JARs or package names which contain embedded JARs. In the case of package names, the embedded JARs of all packages that recursively depend on, import, or suggest the specified package are also included. |
serialize.output |
Logical indicating whether Scala output should be serialized back to R. This is slower and probably only needed on Windows. |
stdout |
When |
stderr |
Same as |
port |
If |
heap.maximum |
String giving Scala's heap maximum, e.g., "8G" or "512M".
The value here supersedes that from |
command.line.arguments |
A character vector of extra command line arguments to pass to the Scala executable, where each element corresponds to one argument. |
debug |
(Developer use only.) Logical indicating whether debugging should be enabled. |
Multiple interpreters can be created and each runs independently with its own memory space. Each interpreter can use multiple threads/cores, but the bridge between R and Scala is itself not thread-safe, so multiple R threads/cores should not simultaneously access the same bridge.
Terminate the bridge using close.rscalaBridge
.
Returns a Scala bridge.
David B. Dahl (2019). "Integration of R and Scala Using rscala." Journal of Statistical Software, 92:4, 1-18. https://www.jstatsoft.org
close.rscalaBridge
, scalaMemory
scalaPushRegister
, scalaPullRegister
s <- scala()
rng <- s $ .new_scala.util.Random()
rng $ alphanumeric() $ take(15L) $ mkString(',')
s * '2+3'
h <- s(x=2, y=3) ^ 'x+y'
h $ toString()
s(mean=h, sd=2, r=rng) * 'mean + sd * r.nextGaussian()'
close(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.