[Rd] R CMD check: "T used instead of TRUE"

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 18 09:59:24 CEST 2006

On Thu, 18 May 2006, Lutz Prechelt wrote:

> Hello everybody,
> I am just trying to put together my first own CRAN-able package.
> I have completed the programming and my code works OK.
> But now when I perform
>  R CMD check agsemisc_1.0-2.tar.gz
> and R gets to the step
>  * checking examples ...
> I receive the following error message:
>  > print(bwplot(Species~Sepal.Length, data=iris, panel=panel.bwstrip))
>  Error in rep(T, length(x)) : T used instead of TRUE
> which apparently complains about a use of T that occurs not
> in the example, but rather in the implementation of the function
> called by the example.
> I have searched the R-devel archives for a reference to that
> error message and in
> https://stat.ethz.ch/pipermail/r-devel/2006-February/036520.html
> found a mention of function cleanEx() that is
> apparently generated by R CMD check(?) and that contains
>  delayedAssign("T", stop("T used instead of TRUE"),
>    assign.env = .CheckExEnv)
>  delayedAssign("F", stop("F used instead of FALSE"),
>    assign.env = .CheckExEnv)
> (BTW: A rather fascinating feature. I would not have thought
> this possible.)
> My questions:
> - Is my perception correct that this is meant as a check
>  for robust programming style?
>  (Because T might change while TRUE cannot?)


> - Is it correct that I should change ALL occurrences of
>  T or F in my package code independent of their context?
>  Or are there different kinds of contexts?

All those where T and F mean TRUE/FALSE and not variable names.

This is in An Introduction to R, section 2.4.

> - Are there any other similar checks that are performed by
>  R CMD check?
> - I cannot find such a thing mentioned in Secion 1.3.1 of
>  R-exts.pdf that describes the actions of R CMD check.
>  The most pertinent item appears to be number 13:
>    "The examples provided by the package's documentation are run."
>  Would you say this is a documentation defect that I ought
>  to report to R-bugs?

It is the pertinent item (but it is item 14 in current R).  It does not 
say how they are run (and they are for example each run in as clean an 
environment as possible).  I think it would be wrong to assume that the 
description there is exhaustive.  But we'll add a cross-reference.

> Any help is appreciated.
> Thanks in advance,
>  Lutz Prechelt
> Prof. Dr. Lutz Prechelt; prechelt at inf.fu-berlin.de
> Institut fuer Informatik; Freie Universitaet Berlin
> Takustr. 9; 14195 Berlin; Germany
> +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list