Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205399

Load R packages only once when executing R scripts via bash

$
0
0

I have an R file example.r which basically looks like this:

#!/usr/bin/env Rscript
# do something ...
library(somelibrary)
# do something with somelibrary functions

And a bash script which needs to call Rscript example.r <PARAMETER> multiple times with different input parameters during one execution. My question is whether there is way to load the package somelibrary only once. Right now the package is loaded every time I call the script, which causes some overhead.


Viewing all articles
Browse latest Browse all 205399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>