sendData {jrc} | R Documentation |
Send data to a web page
Description
Sends a variable to a web page, where it is saved under a specified name. This function
is a wrapper around sendData
method of class Session
.
Usage
sendData(
variableName,
variable,
keepAsVector = FALSE,
rowwise = TRUE,
sessionId = NULL,
wait = 0
)
Arguments
variableName |
Name that the variable will have on the web page. |
variable |
Variable to send. |
keepAsVector |
If |
rowwise |
If |
sessionId |
An ID of the session to which the data should be sent. Can also be a vector of multiple session IDs.
If |
wait |
If |
Details
To send data back from the web page to the current R session one should usejrc.sendData(variableName, variable, internal)
.
Its arguments are:
variableName
-
Name that the variable will have in the R session. If variable name hasn't been previously added to the list of allowed variables (see
allowVariables
orallowedVariables
argument of theopenPage
function), attempt to assign it from a web page will require manual authorization on the R side. variable
-
Variable to send.
internal
(optional)-
Whether this variable should be used only by the session that sent it. If
true
, variable will be stored in the session-specific environment and can be accessed from the outside withgetSessionVariable
function. Iffalse
, variable will be saved to the outer environment of the app (seesetEnvironment
). By default, usestrue
for variables that already exist in the session specific environment (seesetSessionVariables
orsessionVariables
argument of theopenPage
function.) andfalse
otherwise.
See Also
authorize
, allowVariables
, sendCommand
,
callFunction
, sendHTML
, openPage
, getSessionIds
.
Examples
## Not run:
# to run this example an installed web browser is required
openPage()
x <- 1:100
sendData("x", x)
sendCommand("console.log(x);")
sendCommand("jrc.sendData('x', x.filter(function(e) {return e % 2 == 0}))")
closePage()
## End(Not run)