How to avoid reloading libraries and data when using R CMD BATCH at command line?

I am having another program invoke R via a .bat file. The .bat file is very simple - "R CMD BATCH myscript.R". Everything works fine but I wish my script would run faster

If I run the script in RStudio after having loaded the libraries and data, the script takes about 2 seconds. If I run it with the .bat file it takes about 6.5 seconds. Every time the .bat file runs, it has to load in libraries and some data first. Is there a way around this?

I am new to using the command line in this way so please be gentle :slight_smile: I am on Windows, in case that was not clear. Thanks in advance!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.