How to not run an example using roxygen2?

Viewed 28402

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?

5 Answers
\dontrun{}

Is the correct function. See here:

For the purpose of illustration, it’s often useful to include code that causes an error. \dontrun{} allows you to include code in the example that is not run. (You used to be able to use \donttest{} for a similar purpose, but it’s no longer recommended because it actually is tested.)

Source: https://r-pkgs.org/man.html?q=donttest#man-functions

Related