Search code examples
rpackagerepositorybuilding

R CMD check does not respect repository option


I have the following state in the R console of R-Studio:

> options('repos')   
$repos  
[1]   URL of our proxy server

But when I run

system("R CMD check ./")

I get the following error message (translated from German):

\* checking package dependencies ... Warning: cannot access index for repository 
https://CRAN.R-project.org/src/contrib  

The check then fails. What can I do about this?


Solution

  • The checks are run in a separate process running R, so any options settings in RStudio won't be seen.

    There are several ways to set the repositories described in the help page ?setRepositories. If you want to use the repositories for everything, not just this run, then editing R_HOME/etc/repositories is most permanent. For more flexibility you could do this in one of the startup files by calling options(repos=...) there, possibly conditioning on an environment variable or something else.