简体   繁体   中英

Load variable once in DeployR

I have a model trained and stored in a file called "rpartModel.RData", in my R script to use this model in DeployR, I need to load the model every time the script is called. There is any way to load the file only once and the variable be used in the R scripts?

My code:

library(caret)
load("rpartModel.RData") #no way to run just once and be used as global?
predict(fitRPart,kyphosis[10,])

Found it.

Using the RBroker I can espcify a file to be preloaded, like in this java example https://github.com/deployr/java-example-fraud-score/blob/master/src/main/java/com/revo/deployr/rbroker/example/service/FraudService.java .

PoolPreloadOptions preloadOptions = new PoolPreloadOptions();
preloadOptions.filename = "rpartModel.rData";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM