1

By default, R looks for a .Renviron file in the home directory (as explained e.g. here: https://stackoverflow.com/a/43785071).

In that .Renviron file, a custom package installation directory can be specified with R_LIBS_USER=/some/path.

Can I pass a custom .Renviron file to an CLI R session, i.e. something like below?

R --environment=/my/custom/folder/.Renviron

or

Rscript --environment=/my/custom/folder/.Renviron

to overwrite ~/.Renviron (or if there's no .Renviron in the home directory at all).

grssnbchr
  • 2,877
  • 7
  • 37
  • 71

1 Answers1

0

Thanks to @nicola, I was able to open up an ad-hoc R session with a custom R_LIBS path like so. That was the initial idea, using an .Renviron file is not even necessary anymore.

export R_LIBS_USER=~/my/custom/folder/lib
R
grssnbchr
  • 2,877
  • 7
  • 37
  • 71