Search code examples
ropencpu

How to run a custom.R script using OpenCPU


I have a question that seems like it should be simple, however it doesn't seem to be addressed in the OpenCPU API documentation. I have setup and configured my OpenCPU server just fine, I can browse http://localhost/ocpu/test/ and I can explore everything just fine. When going through the documentation I can see it is quite easy to run through a package, but is there a way to just run a simple .R file on my server without having to turn it into a package? I'd rather not have to turn it into a package to test it. Anyone know if this is possible and if so what's the correct API?


Solution

  • No. From the OpenCPU FAQ #2: An OpenCPU app is an R package which includes some web page(s) that call the R functions in the package using the OpenCPU API (emphasis mine). I strongly encourage you to learn to make packages, even if just for random functions. Hadley's devtools package (among others) make building packages much easier; if you need help, his r-pkgs docs are quite good.