[R-pkg-devel] Switch between \dontrun{ } and \donttest{ }.

Rolf Turner ro||turner @end|ng |rom po@teo@net
Fri Oct 20 02:17:01 CEST 2023


In a package that I maintain, there are examples, in the *.Rd files,
that take an excruciatingly long time to run.  This makes package
checking extremely tedious.  There is no question of errors being
thrown from these examples, they are simply time consuming.  (The check
is being run to look for possible errors elsewhere.)

I therefore would like to wrap these examples in \dontrun{ }.

However when the package is submitted to CRAN, it is expedient to wrap
the examples in \donttest{ } rather than \dontrun{ }.

I would therefore like to find a means of effecting the following
logical structure:

    if(package is being checked by CRAN) {
        Use \donttest{ }
    } else {
        Use \dontrun{ }
    }

Is there a reasonably straightforward means of detecting whether
the package is being checked by CRAN, and thereby setting up such a
logical structure? Perhaps based on environment variables?

Can anyone give me any guidance?  Thanks.

cheers,

Rolf Turner

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
         +64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619




More information about the R-package-devel mailing list