I noticed some packages use slight variations of @examplesIf (identical(Sys.getenv("NOT_CRAN"), "true") || identical(Sys.getenv("IN_PKGDOWN"), "true"))
to skip examples on CRAN. For me, NOT_CRAN
is set to ""
. I believe that's the default. In that case, it would be rare that it's true. In that case, the examples would usually not run. Why not just use \dontrun
then?
A couple of CRAN packages use a variation of this: GitHub CRAN search.
NOT_CRAN=true
is set by devtools::check()
and it is also set by r-lib/actions/setup-r
, so the examples run in local checks if the developers use devtools, and also on the CI machines, if they use r-lib/actions
.
The IN_PKG_DOWN
part of the condition makes sure that they also run when creating the pkgdown manual.
1 Like
I didn't realize it's set by devtools. That makes a lot more sense now.