You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
#' Foo#' @examplesIf FALSE#' stop("You can't run this.")#' @name fooNULL
The generated .Rd is:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/foo.R
\name{foo}
\alias{foo}
\title{Foo}
\description{
Foo
}
\examples{
\dontshow{if (FALSE) withAutoprint(\{ # examplesIf}
stop("You can't run this.")
\dontshow{\}) # examplesIf}
}
You'll notice that the \dontshow macros are wrapping an if statement enclosing the entire examples section. That if statement is not shown but is present in the code that R CMD check runs, disabling the block from being executed.
Hello,
The "rd"" vignette claims that the code of the example is not executed during the
check
when theIf
condition isFALSE
.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:
And I also found the following claim when I googled:
Here to be precise. Note this is an old thread (2005).
The text was updated successfully, but these errors were encountered: