Make sure renv is activated, even if a script is run from
Rscript or littler.
Arguments
- project
Optional path to a project root. If
NULL(the default), search upward from the script's directory when known, otherwise fromgetwd(). The script directory is taken fromRscript's--file=argument when present, or from source references under littler.- quiet
If
TRUE(the default), suppress messages.
Value
The project root path (invisibly) if renv was activated
or was already active; otherwise NULL.
Details
Package renv
makes workflows reproducible by locking down the versions of
R packages. Normal renv mechanisms can fail, however,
if a script is run from Rscript or littler.
Adding
to the top of R scripts fixes the problem.
For more details, see the article Using command with renv.
See also
cmd_assign()Process command line arguments