Learn R Programming

rscala (version 3.2.25)

scalaDisconnect: Temporarily Disconnect Scala by Closing Connections

Description

This function temporarily disconnects a Scala bridge by closing its associated socket connections. The primary place where this function is used is at the end of examples of packages that depend on rscala (because, under some versions of R, "R CMD check --as-cran" does not permit connections to persist after an example ends).

Usage

scalaDisconnect(bridge = scalaFindBridge())

Arguments

bridge

A Scala bridge.

Examples

Run this code
# \donttest{
showConnections()
s <- scala()
showConnections()         # No additional connections yet.
s * "3+4"
showConnections()         # Now there are two additional connections.
scalaDisconnect()
showConnections()         # The new connections are gone.
s * "3+4"
showConnections()         # New connections are established as needed.
close(s)
# }

Run the code above in your browser using DataLab