Probably the lightest weight way to do this is to set a global knitr option in the setup chunk of the vignette which is true if a environment variable is set and FALSE
otherwise. Then you can set the environment variable in your local .Renviron
file (and potentially on CI services like travis). This way the vignette chunks will be run when you build your package locally but not when CRAN builds and checks your package.
opts_chunk$set(eval = nzchar(Sys.getenv("MY_ENV_VARIABLE")))