I've written an R function in my package which returns a data frame. I'd like to call my function from javascript and use it to populate a table. I am able to successfully call the function using the ocpu/test
interface and get back JSON
.
I'm looking for a minimal example of how to do it with ocpu.rpc
. I was thinking it could be finding the leading rows of the faithful
data set using head
: e.g. head(faithful)
. However, I think that the ocpu.rpc
request can't be used with data already in R.
Based on the documentation, I thought the code should be:
ocpu.seturl("http://public.opencpu.org/ocpu/library/mylib/R");
var req = ocpu.rpc("func", { x : "param" }, function(obj) { return obj });
But req
is undefined when I inspect it. What am I missing?