Could not display R script on local single-user OpenCPU server

I installed the local single-user OpenCPU server using RStudio. I also create my own R package (package name: test ), which includes only a simple test.R file. Source

f1 <- function(x, y) {x+y}

I started the OpenCPU server by typing library(opencpu)in the RStudio console. I got the following print.

Initiating OpenCPU server...
OpenCPU started.
[httpuv] http://localhost:6067/ocpu
OpenCPU single-user server ready.

I managed to run the script by typing curl http://localhost:6067/ocpu/library/test/R/f1 -d "x=33&y=3".

But when I tried to display the R script (test.R) by typing curl http://localhost:6067/ocpu/library/test/R/test.R, it printed

object 'test.R' not found

In call: get(reqobject, paste("package", reqpackage, sep = ":"), inherits = FALSE)

Also, it failed when I ran test.R script by typing curl http://localhost:6067/ocpu/library/test/R/test.R -X POST -d "x=3&y=4". Can I run the script this way?

Can anyone help with this? Thank you

+3
source share
1

R, /R /. , :

curl http://localhost:6067/ocpu/library/test/R/f1/print
curl http://localhost:6067/ocpu/library/test/R/f1/ascii
+1

All Articles