Skip to content
Prev 58181 / 63424 Next

R CMD check --as-cran attempts to hide R_LIBS_USER but fails

On Wed, Mar 18, 2020 at 8:04 PM Dirk Eddelbuettel <edd at debian.org> wrote:
1. --as-cran sets R_LIBS_SITE='no_such_dir' and R_LIBS_USER='',
whereas without --as-cran they're not set.

2. --as-cran sets R_LIBS_USER='no_such_dir' on Windows and there it is
masked, i.e. tests scripts do NOT see user's personal library because
print(Sys.getenv("R_LIBS_USER")) is reported as "'no_such_dir'"
(sic!).

The only other interpretation I can imagine from using R_LIBS_USER=''
on Linux is that is exists there to force the default settings in case
it is already set externally by user.  For example, if one do

  export R_LIBS_USER="$PWD"
  R --vanilla CMD check --as-cran teeny_0.1.0.tar.gz

then tests scripts still get R_LIBS_USER="~/R/x86_64-pc-linux-gnu-library/3.6".

But, then why is there a difference between Windows and Linux in this
essential behavior?  To me, this suggests there is a mistake
somewhere.  OTH, I know that lots of oddities in R exist for a reason.

/Henrik