opencpu

How to call an self-designed R function on openCPU via javascript?

牧云@^-^@ 提交于 2019-12-06 16:13:45
问题 The new openCPU platform allows integration of R functions within HTML/javascript. However I have been struggeling with the implementation. Could somebody provide an example of how to upload your self-designed R function to openCPU and call it with its parameters via javascript? 回答1: Here is a standalone HTML page that does the job. It sends a request to the openCPU server and gets a json object back with keys that point to the appropriate objects on that same server which I then inject into

How to set the opencpu default port for single user

左心房为你撑大大i 提交于 2019-12-06 10:34:25
I am working with opencpu. I installed the opencpu as a single user mode. When the session is expired the link is down and sometimes the port number is changing dynamically. I would like the port to be constant during every run even the current session is expired. You can set the port when you start the single user server: library(opencpu) opencpu$stop() opencpu$start(1234) This will start opencpu on port 1234. I recommend you try the cloud server, which always runs on port 80 (http) and 443 (https). 来源: https://stackoverflow.com/questions/32647584/how-to-set-the-opencpu-default-port-for

How to start/stop/flush OpenCPU on CentOS6?

心不动则不痛 提交于 2019-12-06 03:17:20
I've successfully built and installed OpenCPU and RStudio Server on a CentOS6. Everything is working as expected, and I do get successful GET/POST responses for my local R packages. A couple of things that don't seem to work however: I can't figure a clean way to start/stop/flush OpenCPU. I'm currently using apachectl restart but I'm not even sure that does reload R packages as expected. I tried Jeroen's bash scripts at /usr/lib/opencpu/scripts but they seem to require quite a bit of tweaking to work on CentOS. (maybe related to above) I am using load() and readRDS() in /etc/opencpu/Renviron

How to call an self-designed R function on openCPU via javascript?

别说谁变了你拦得住时间么 提交于 2019-12-04 19:14:26
The new openCPU platform allows integration of R functions within HTML/javascript. However I have been struggeling with the implementation. Could somebody provide an example of how to upload your self-designed R function to openCPU and call it with its parameters via javascript? Here is a standalone HTML page that does the job. It sends a request to the openCPU server and gets a json object back with keys that point to the appropriate objects on that same server which I then inject into the page. Just download the code and click on the "Run Code" button. <!DOCTYPE html> <html xmlns="http://www

Are data objects persistent in openCPU's R session?

吃可爱长大的小学妹 提交于 2019-12-01 06:31:43
I would like to provide a web tool that requires access to a large dataset. Preferentially, this R data object should be loaded into memory once and then be available for user-defined queries. Does the openCPU framework support persistant data objects in any way or does every query begin with a blank slate? The OpenCPU API is stateless, there is no way to keep a process alive in between requests. But you can easily solve your problem by putting your dataset into a package, and installing that on the server. You can use the preload option described in the server manual , or use the /etc/opencpu

unable to access R packages under user account in opencpu

血红的双手。 提交于 2019-12-01 05:17:36
I am trying to access R packages which were installed under a user's account from opencpu. I can see that the package is installed when I start R as that user: > installed.packages() Package LibPath RLIM "RLIM" "/limdata/ali/R/x86_64-pc-linux-gnu-library/3.0" ... > system('whoami'); ali However, when I try to access the library from opencpu, I get errors indicating the package was not found: $ curl -L http://<my.server>/ocpu/user/ali/library/RLIM there is no package called 'RLIM' In call: find.package(pkgname, lib.loc = lib.loc) # from same server, to confirm opencpu is running... $ curl -L

unable to access R packages under user account in opencpu

倾然丶 夕夏残阳落幕 提交于 2019-12-01 02:21:00
问题 I am trying to access R packages which were installed under a user's account from opencpu. I can see that the package is installed when I start R as that user: > installed.packages() Package LibPath RLIM "RLIM" "/limdata/ali/R/x86_64-pc-linux-gnu-library/3.0" ... > system('whoami'); ali However, when I try to access the library from opencpu, I get errors indicating the package was not found: $ curl -L http://<my.server>/ocpu/user/ali/library/RLIM there is no package called 'RLIM' In call:

Suggestions needed for building R server REST API's that I can call from external app?

旧城冷巷雨未停 提交于 2019-11-30 11:33:25
问题 I've seen lots of articles about consuming data in R from other RESTful API services, but I have really struggled to find any articles about the reverse. I'm interested in R being the server, and not the client. I'd like a Node.js app to call a RESTful API of an R-server so I can leverage specific analytical functions such as multi-seasonality forecasting. Anyone have any ideas? 回答1: You can use httpuv to fire up a basic server then handle the GET / POST requests. The following isn't "REST"

Error in YAML with R Markdown

假如想象 提交于 2019-11-29 15:31:58
I have the following R Markdown script called test.Rmd : --- params: results: value: !r mtcars --- ```{r setup, echo=FALSE, include=FALSE} df <- params$results knitr::kable(df) ``` When I run the following in OpenCPU: library(rmarkdown) library(knitr) rmarkdown::render("test.Rmd", output_format = "html_document") Error in yaml::yaml.load(yaml, handlers = knit_params_handlers(evaluate = evaluate), : unused argument (eval.expr = TRUE) I installed different versions of YAML and it didn't fix the problem. sebastian zapata Install the devtools package from CRAN. In R, run the following: library