Reputation: 35
I need to run (several times) my R script (script.R), which basically looks like this:
library(myLib)
cmd = commandArgs(TRUE)
args=myLib::parse.cmd(cmd)
myLib::exec(args)
myLib
is my own package, which load some dependencies (car, minpack.lm, plyr, ggplot2). The time required for loading libraries is comparable with the time of myLib::exec
, so I'm looking for a method which helps me not to load them every time I call Rscript script.R
I know about Rserve
, but it looks like a little bit overkill, though it could do exactly what I need. Is there any other solutions?
P.S: I call script.R
from JVM using Scala.
Upvotes: 2
Views: 1228
Reputation: 119
I tried littlr, seems amazing, but don't want to work on R v4.0. Rserve seems cool but like you pointed out it seems to be an overkill.
I end up limiting the import to the functions I need. For example:
library(dplyr, include.only = c("select", "mutate","group_by", "summarise", "filter" , "%>%", "row_number", 'left_join', 'rename') )
Upvotes: 0
Reputation: 368439
Briefly:
so I think you answered your question.
Otherwise, I enjoy littler and have shown how it starts faster than either R or Rscript -- but the fastest approach is simply not to restart.
Upvotes: 2