powered by
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:
runR=shinylight::runR(c("+", "plot", "c", "x", "y"))
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)
A function that can be passed as one of the elements of slServer's interface argument.
slServer
interface
A list of permitted symbols in the R command
server <- slServer( port = 50050, interface = list( run_the_users_r_code = runR( list("c", "$", "list", "+", "-", "/", "*", "sqrt") ) ) ) # ... slStop(server)
Run the code above in your browser using DataLab