hrecht / censusapi

R package to retrieve U.S. Census data and metadata via API
https://www.hrecht.com/censusapi/
169 stars 31 forks source link

Vignette code chunks not evaluating in pkgdown build #32

Closed hrecht closed 6 years ago

hrecht commented 6 years ago

Examples in the Getting Started vignette that require an API key are not run on CRAN, using the NOT_CRAN convention established in other documentation.


{r, echo = FALSE}
NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")
knitr::opts_chunk$set(purl = NOT_CRAN)

For example, this code chunk does not evaluate in the pkgdown documentation build:


{r, purl = NOT_CRAN, eval = NOT_CRAN}
getCensus(name = "timeseries/healthins/sahie",
    vars = c("NAME", "IPRCAT", "IPR_DESC", "PCTUI_PT"), 
    region = "us:*", time = 2015)

This is currently leading to the pkdown build of the vignette not showing results. When compiled locally with knitr, these code chunks do evaluate as intended.

jayhesselberth commented 6 years ago

It looks like the googlesheets vignette also sets eval = NOT_CRAN in knitr::opts_chunk; your vignette does not.

https://github.com/jennybc/googlesheets/blob/master/vignettes/managing-auth-tokens.Rmd

Does that help?

hrecht commented 6 years ago

Thanks! I'll try this

hrecht commented 6 years ago

This fix and setting NOT_CRAN in my .Renviron worked, thanks @jayhesselberth !