Skip to content

Always overwrites R_LIBS_SITE even when site-library exists under R_HOME #86

@paithiov909

Description

@paithiov909

arf currently seems to unconditionally set R_LIBS_SITE to the $(R_HOME)/library directory, even if a site-library subdirectory already exists under R_HOME.

However, this behavior appears to differ slightly from base R's initialization logic as described in ?base::libPaths:

First, .Library.site is initialized from R_LIBS_SITE. If this is unset or empty, the ‘site-library’ subdirectory of R_HOME is used. Only directories which exist at the time of initialization are retained. Then, .libPaths() is called with the combination of the directories given by R_LIBS and R_LIBS_USER. By default R_LIBS is unset, and if R_LIBS_USER is unset or empty, it is set to directory ‘R/R.version$platform-library/x.y’ of the home directory on Unix-alike systems (or ‘Library/R/m/x.y/library’ for CRAN macOS builds, with m Sys.info()["machine"]) and ‘R/win-library/x.y’ subdirectory of LOCALAPPDATA on Windows, for R x.y.z.

In practice, some R environments do provide a site-library directory under R_HOME even without any explicit configuration. For example, the R distribution installed via Scoop on Windows includes a site-library directory linked to another persisted location.

It seems that arf currently ignores this existing site-library and overwrites R_LIBS_SITE regardless of the directory structure. It would be helpful if arf could respect the default R behavior and detect whether site-library already exists before setting R_LIBS_SITE.

Session Information

arf version:    0.2.2
OS:             windows (x86_64)
Config file:    ~\AppData\Roaming\arf\arf.toml (not found, using defaults)
R version:      4.5.2
R_HOME:         ~\scoop/apps/r/current
R source:       PATH

rig:            not installed
air:            not installed

Current mode:   R

R history:      ~\AppData\Roaming\arf\history\r.db
Shell history:  ~\AppData\Roaming\arf\history\shell.db

## Environment Variables

R_LIBS_USER:    ~\AppData\Local/R/win-library/4.5
R_LIBS_SITE:    ~\scoop\apps\r\current\library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions