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

Lutz Prechelt prechelt at inf.fu-berlin.de
Thu May 18 09:44:51 CEST 2006

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
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?
- 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?

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/

More information about the R-devel mailing list