Skip to content
Prev 61004 / 63421 Next

Respecting custom repositories files in interactive/batch R sessions

Friends,

I always keep forgetting how these things currently/precisely work, but
I guess the principle is that utils:::.onLoad() does

  options(repos = c(CRAN = "@CRAN@"))

unless the repos option was already set (in the user or site profiles).
As the latter are not used when checking, the check code in tools takes
advantage of the repositories file mechanism, see ? setRepositories:

     The default list of known repositories is stored in the file
     ?R_HOME/etc/repositories?.  That file can be edited for a site, or
     a user can have a personal copy in the file pointed to by the
     environment variable ?R_REPOSITORIES?, or if this is unset or does
     not exist, in ?HOME/.R/repositories?, which will take precedence.

which also points to Startup etc).

I guess one could teach utils:::.onLoad() to use the user/site
repositories setting instead of the hard-wired CRAN = @CRAN@?  Afaict,
that would make no difference if the repositories file was not
configured, and provide the configured setting in case repos was not set
in the user/site profile ...

Best
-k