From murdoch.duncan at gmail.com  Mon Sep  3 13:41:25 2012
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Mon, 03 Sep 2012 07:41:25 -0400
Subject: [Rd] if(--as-cran)?
In-Reply-To: <50444374.50709@prodsyse.com>
References: <50444374.50709@prodsyse.com>
Message-ID: <50449765.4030208@gmail.com>

On 12-09-03 1:43 AM, Spencer Graves wrote:
> Hello, All:
>
>
>         The fda package has tests that run too long for CRAN's current
> rules.  I'd like to wrap some examples in a construct like the following:
>
>
> if(!CRAN()){
> ...
> }
>
>
>         I tried the following:
>
>
> CRAN <- function(x='_R_CHECK_CRAN_INCOMING_'){
>       x. <- Sys.getenv(x)
>       xl <- as.logical(x.)
>       notCRAN <- is.na(xl) || xl
> #
>       return(!notCRAN)
> }
>
>
>         The companion help page included the following example:
>
>
> if(CRAN()){
>     stop('CRAN')
> } else {
>     stop('NOT CRAN')
> }
>
>
>         This reported "NOT CRAN" even with "R CMD check --as-cran".

There's no user-visible setting for --as-cran, because it just sets a 
number of other options.  You could query one of those.  The settings 
that are visible are

_R_CHECK_TIMINGS_  (which seems most relevant to you)
_R_CHECK_INSTALL_DEPENDS_
_R_CHECK_NO_RECOMMENDED_
_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_

So I'd check the value in _R_CHECK_TIMINGS_, or maybe just its existence.

Duncan Murdoch



[Rd] if(--as-cran)?
Duncan Murdoch