Skip to content

The purpose of @examplesIf #1649

@stla

Description

@stla

Hello,

The "rd"" vignette claims that the code of the example is not executed during the check when the If condition is FALSE.

However it seems to me that this is not what happens in reality.

This tag includes some \dontshow in the generated Rd code, and according to Writing R Extensions, the \dontshow macro never prevents the execution of the code, it just hides the code to the user, but during R CMD CHECK, this code is executed.

Here is the WRE illustration:

x <- runif(10)       # Shown and run.
\dontrun{plot(x)}    # Only shown.
\dontshow{log(x)}    # Only run.

And I also found the following claim when I googled:

Examples displayed and executed during checks/example runs:
as is
Examples displayed but NOT executed during checks/example runs:
\dontrun{}
Examples NOT displayed but executed during checks/example runs:
\dontshow{}
Examples NOT displayed and NOT executed during checks/example runs:
simply don't type them anywhere ;-)

Best,
Uwe Ligges

Here to be precise. Note this is an old thread (2005).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions