From gregory.warnes at novartis.com  Thu Sep  6 15:33:54 2012
From: gregory.warnes at novartis.com (Warnes, Gregory)
Date: Thu, 6 Sep 2012 13:33:54 +0000
Subject: [Rd] if(--as-cran)?
In-Reply-To: <50488BD2.2090200@gmail.com>
Message-ID: <0CAEE2B1235DF643B0F5E1EAE1487B53094715C0@023-CH1MPN1-043.023d.mgd.msft.net>


On 9/6/12 7:41 AM, "Duncan Murdoch" <murdoch.duncan at gmail.com> wrote:

>
>If Martin or I added a new environment variable _R_CHECK_LEVEL_, and
>perhaps support code to let you set it in R CMD check or elsewhere, and
>support functions to let you read it without the work of calling
>Sys.getenv(), and documentation for its purpose -- that doesn't mean it
>would be ever be used.  I would have no objection whatsoever if he wants
>to do that work, [..]
>[...]
>So if Martin wants to implement something, I'd suggest that he
>coordinate offline with CRAN.

With this in mind, I've taken the time to create a proposed implementation:

1) New environement variable _R_CHECK_LEVEL_ which can take values from
{NONE, MINOR, CRAN, DEFAULT, MAJOR, FULL}
2) New R CMD CHECK flag --level={NONE, MINOR, CRAN, DEFAULT, MAJOR, FULL},
which sets  the value of _R_CHECK_LEVEL_, defaulting to "DEFAULT".

3) R CMD CHECK flag --as-cran sets _R_CHECK_LEVEL_ to CRAN (overwriting
any previous environment variable or --level setting)
4) A new function: tools::getCheckLevel() that returns an ordered factor
with levels {NONE, MINOR, CRAN, DEFAULT, MAJOR, FULL}.
5) An associated man page, with the example:

	if(getCheckLevel() > "CRAN") {
	    cat("## Do time-intenstive test ##\n")
	} else {
	    cat("## Do brief test\n")
	}

Duncan, how should I coordinate this with CRAN, simply drop an email to
cran at r-project.org?

Everyone: I'll post a pointer to the patch as soon as I've tested it.

-Greg
     



[Rd] if(--as-cran)?
Warnes, Gregory