Dear Ben,
I think that you first need to go to your project and then start Rscript
from that location. renv() needs to pick up the .Renviron file located at
the root of your project.
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx at inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be
///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////
<https://www.inbo.be>
Op di 14 apr. 2020 om 19:53 schreef Ben Tupper <btupper at bigelow.org>:
> 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 <btupper at 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 at 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.
>
[[alternative HTML version deleted]]