Learn R Programming

jrc (version 0.2.1)

openPage: Create a server

Description

openPage creates a server and establishes a websocket connection between it and the current R session. This allows commands exchange. In R use sendCommand function to send and execute JavaScript code on the server. On the server use jrc.sendCommand function to send and execute R code in the current R session.

Usage

openPage(useViewer = T, rootDirectory = NULL, startPage = NULL,
  port = NULL, browser = getOption("browser"),
  allowedFunctions = NULL, allowedVariables = NULL)

Arguments

useViewer

If TRUE, the start page will be opened in the RStudio Viewer. If FALSE a default web browser will be used.

rootDirectory

A path to the root directory of the server. If rootDirectory is not defined, the http_root in the package directory will be used as a root directory.

startPage

A path to the HTML file that should be opened, when the server is initialised. This can be an absolute path to a local file, or it can be relative to the rootDirectory or to the current R working directory. If startPage is not defined, this function opens an empty HTML page. The file must have .html extension.

port

Defines which TCP port to use for websocket connection. If not defined, random available port is used.

browser

A browser in which the web page will be opened. Is used only if useViewer = FALSE. If not defined, default browser will be used. For more information check browseURL.

allowedFunctions

List of functions that can be called from the web page without any additional actions from the user. All other functions will require authorization in the current R session to be executed. This should be a vector of function names. Check authorize and allowFunctions for more information.

allowedVariables

List of variables that can be reassigned from the web page without any additional actions from the user. All other reassignments will require authorization in the current R session to be executed. This should be a vector of variable names. Check authorize and allowVariables for more information.

See Also

closePage, setEnvironment, limitStorage, allowVariables, allowFunctions.