HenrikBengtsson / startup

:wrench: R package: startup - Friendly R Startup Configuration
https://henrikbengtsson.github.io/startup/
160 stars 5 forks source link

Try to infer original, unexpanded R_LIBS, R_LIBS_SITE, R_LIBS_USER #108

Open HenrikBengtsson opened 2 years ago

HenrikBengtsson commented 2 years ago

Issue

If one of R_LIBS, R_LIBS_SITE, R_LIBS_USER is set in .Renviron, e.g.

R_LIBS_USER=~/R/%p-library/%v

it'll automatically be expanded by R early on during the startup process. Using Sys.getenv() from R will only show the expanded version, e.g.

Sys.getenv("R_LIBS_USER")
#> /home/hb/R/x86_64-pc-linux-gnu-library/4.1

which is also what startup::startup(debug = TRUE) currently reports.

Wish

$ R_STARTUP_DEBUG=true R
...
0.002s: - '~/.Renviron' => '/home/hb/.Renviron': '/home/hb/.Renviron' (2 lines; 102 bytes)
setting 1 environment variables ('R_LIBS_USER')
...
0.005s: - R_LIBS: ''
0.005s: - R_LIBS_SITE: ''
0.006s: - R_LIBS_USER: '/home/hb/R/x86_64-pc-linux-gnu-library/4.1' (expanded from 
`R_LIBS_USER=~/R/%p-library/%v` in '~/.Renviron')
...