Whoops! The silly "send" button jumped out and grabbed my cursor before I was ready for it. Second try...
I am using renv (https://rstudio.github.io/renv/) to maintain a project environment in a directory (ala '/path/to/project'). Within the project I have a number of scripts that I call with one argument using... $ Rscript /path/to/script.R /path/to/config_file I can kick this off successfully with the renv environment when I manually start Rscript within the project directory. Now I would like to be able to hand the script kick-off to either crontab or the PBS queueing system. But I haven't figured out how to get the instance of R that is kicked off to do so using the renv project space (i.e. using the R libraries as established in the project.) At first I thought I would call a simple wrapper script such that accepted two arguments '/path/to/script.R' and '/path/to/config_file'. I planned to use ... ### args <- commandArgs(trailingOnly = TRUE) path_to_script <- args[1] path_to_config <- args[2] renv::run(path_to_script, project = '/path/to/project') ### Unfortunately renv::run() doesn't provide a vehicle for passing other script arguments along. So, in this case, there's no way to communicate the configuration file to the script. Is there a recommended way to call Rscript such that the renv environment gets picked up? Thanks! Ben On Tue, Apr 14, 2020 at 1:41 PM Ben Tupper <btup...@bigelow.org> wrote: > Hi, > > I am using renv (https://rstudio.github.io/renv/) to maintain a project > environment in a directory (ala /path/to/project) > > > Within the project I have a number of scripts that I call using... > > $ Rscript /path/to/script.R /path/to/config_file > > I can kick this off successfully with the renv environment when I manually > start Rscript within the project directory. Now I would like to be able to > hand the script kick off to either crontab or the PBS queueing system. > > At first I thought I would actually call a wrapper script such that > accepted two arguments '/path/to/script.R' and '/path/to/config_file'. I > planned to use > > renv::run('/path/to/script.R', > > > -- > Ben Tupper > Bigelow Laboratory for Ocean Science > East Boothbay, Maine > http://www.bigelow.org/ > https://eco.bigelow.org > > -- Ben Tupper Bigelow Laboratory for Ocean Science East Boothbay, Maine http://www.bigelow.org/ https://eco.bigelow.org [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.