How to disable --as-cran from the "check package" IDE command


#1

I’m in a difficult situation where I am developing a package for internal use in a secure environment. Critically this means that there is no outside internet connection. When the check runs it chokes when checking the CRAN and Bioconductor incoming feasibility (ie. the dependencies, name and version). I think that this is because it waits for the connection to time out, as no response is given. When I run the devtools::check(cran=FALSE) directly it runs significantly faster.

I could have sworn that there was a way to turn off the check as CRAN feature, which would disable these checks, but I can not find where that option is. Is it possible to disable the --as-cran? If so how?


#2

You can set the following environment variables to false to turn off the incoming checks. The first turns off all incoming checks, the second only turns off those checks which use remote resources (i.e. the internet). The latter is only available on relatively new versions of R.

_R_CHECK_CRAN_INCOMING_
_R_CHECK_CRAN_INCOMING_REMOTE_

source: https://cran.r-project.org/doc/manuals/r-patched/R-ints.html#Tools


#3

It doesn’t seem like there is a way to pass arguments to devtools::check() when run from the build pane other than the args argument (so it doesn’t seem possible to run with cran = FALSE for instance except on the R command line.

I would suggest you open an issue at https://github.com/rstudio/rstudio/issues requesting this feature


#4

Thanks Jim. Will do. Trying the other as a workaround.


#5

I put

_R_CHECK_CRAN_INCOMING=FALSE

into my ~/.R/check.Renviron file. However, this does not fix the problem. I think because Rstudio/devtools is also passing --no-environ in the check call that the check.Renviron files is not being read in, and thus the environment variable is not being set.


#6

Does Tools > Project Options > Build Tools have --as-cran in the Check Package field?


#7

There is both a leading and trailing underscore in _R_CHECK_CRAN_INCOMING_, you are missing the trailing underscore. With it the environment variables are found and used in ~/.R/check.Renviron.


#8

For easier reference to follow this topic, an issue has been opened