Dan Goldstein Dan Goldstein - 1 year ago 83
R Question

What does "not run" mean in R help pages?

Sometimes on an R help page the phrase "not run" appears in comments. Check out this from the help page for "with()":

require(stats); require(graphics)
#examples from glm:
**## Not run:**
with(anorexia, {
anorex.1 <- glm(Postwt ~ Prewt + Treat + offset(Prewt),
family = gaussian)
## End(**Not run**)

What does the "not run" mean in the example code?

rcs rcs
Answer Source

"not run" encloses code that shouldn't be executed in the example function (e.g. time-consuming code parts, user-interaction, ...).

see e.g. ?example:

As detailed in the manual Writing R Extensions, the author of the help page can markup parts of the examples for two exception rules

  • 'dontrun' encloses code that should not be run.

  • 'dontshow' encloses code that is invisible on help pages, but will be run both by the package checking tools, and the 'example()' function. This was previously 'testonly', and that form is still accepted.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download