sendData | R Documentation |
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
.
sendData(
variableName,
variable,
keepAsVector = FALSE,
rowwise = TRUE,
sessionId = NULL,
wait = 0
)
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 |
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
or allowedVariables
argument of the openPage
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 with getSessionVariable
function. If false
, variable will be saved to the outer environment of the app (see setEnvironment
).
By default, uses true
for variables that already exist in the session specific environment
(see setSessionVariables
or sessionVariables
argument of the openPage
function.)
and false
otherwise.
authorize
, allowVariables
, sendCommand
,
callFunction
, sendHTML
, openPage
, getSessionIds
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.