[R] Package renv and Rscript
btupper @end|ng |rom b|ge|ow@org
Tue Apr 14 19:52:37 CEST 2020
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
$ 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
args <- commandArgs(trailingOnly = TRUE)
path_to_script <- args
path_to_config <- args
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?
On Tue, Apr 14, 2020 at 1:41 PM Ben Tupper <btupper using bigelow.org> wrote:
> 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
> Ben Tupper
> Bigelow Laboratory for Ocean Science
> East Boothbay, Maine
Bigelow Laboratory for Ocean Science
East Boothbay, Maine
[[alternative HTML version deleted]]
More information about the R-help