Search code examples
rroxygen2

How to not run an example using roxygen2?


I'm writing a geocoding function right now that relies on having a Bing Maps Key. Obviously I'd rather not publish mine, and the examples fail without one.

How do I include an example for users to run manually, but not have it executed during R CMD check?


Solution

  • Use \dontrun{}

    #'@examples
    #'\dontrun{
    #'geocode("3817 Spruce St, Philadelphia, PA 19104")
    #'geocode("Philadelphia, PA")
    #'dat <- data.frame(value=runif(3),address=c("3817 Spruce St, Philadelphia, PA 19104","Philadelphia, PA","Neverneverland"))
    #'geocode(dat)
    #'}