look into adding @examplesIf in roxygen
- Dominant language
- C++
- Stars
- 607
- Forks
- 67
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
See https://roxygen2.r-lib.org/articles/rd.html#functions
```
For finer control you can use `@examplesIf
#' @examplesIf interactive()
#' browseURL("https://roxygen2.r-lib.org")
will generate
\examples{
\dontshow{if (interactive() (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
gh_organizations(since = 42)
\dontshow{\}) # examplesIf}
}
```
This way the code evaluating whether the example can be run is not shown to users reading the help, but it still prevents R CMD check failures.
Instead of including examples directly in the documentation, you can put them in separate files and use @example path/relative/to/package/root to insert them into the documentation.
Contributor guide
Assessment
This issue has not been assessed yet.