| runR | R Documentation |
If you set this as a part of your interface, like:
runR=shinylight::runR(c("+", "plot", "c", "x", "y"))
then you can call it from Javascript like this:
rrpc.call("runR", {
Rcommand:"2+2"
}, function(x) {console.log(x);});
rrpc.call("runR", {
Rcommand:"y<-c(2,0,1);plot(c(1,2,3),y);y",
'rrpc.resultformat': {
type: 'png',
width: 200,
height: 300,
}
}, function(x) {img.setAttribute('src', x.plot[0])});
runR(symbolList)
symbolList |
A list of permitted symbols in the R command |
A function that can be passed as one of the elements of
slServer's interface argument.
server <- slServer(
port = 50050,
interface = list(
run_the_users_r_code = runR(
list("c", "$", "list", "+", "-", "/", "*", "sqrt")
)
)
)
# ...
slStop(server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.