How to not run an example using roxygen2?

后端 未结 4 1843

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

4条回答
  •  渐次进展
    2020-12-08 13:17

    For those who are using @example path/to/example.R instead of the @examples tag you can use the \dontrun environment directly in the example.R file. For example

    # example.R
    \dontrun{
    # this is a long running example
    for(i in seq(1, 1e5)) { lm(mpg ~ wt, data = mtcars) }
    }
    
    # some other shorter example
    2 + 2
    

提交回复
热议问题