An R package communicates with a commercial data base using a private user_name and password to establish connection. In the package_vignette.Rmd file there is a chunk of code:
```{r, eval = TRUE}
# set user_name and password from user's configuration file
set_connection(file = "/home/user001/connection.config")
# ask data base for all metrics it has
my_data <- get_all_metrics()
# display names of fetched metrics
head(my_data$name)
```
I do not have the rights to provide actual user_name and password to CRAN, so I can not supply genuine 'connection.config' file with the package. So, of course, this code fragment leads to Error during CRAN checks.
I know two ways to get around CRAN check:
Use knitr option:
eval = FALSE
.Make static vignette with help of the R.rsp package.
The first way is too time-consuming, because there are a lot of chunks,
and I rewrite/rebuild the vignette often.
The second way is better for me. But may be there is a better pattern how to support such vignette? For example, in the package's tests I use testthat::skip_on_cran()
to avoid CRAN checks.
eval=F
by callingknitr::opts_chunk$set(eval=F)
inside the first chunk. – Taught