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.