[R] if(foo == TRUE) .. etc

Thomas Lumley tlumley at u.washington.edu
Fri Apr 22 19:41:03 CEST 2005


On Fri, 22 Apr 2005, bogdan romocea wrote:

> Great suggestion; it made me change all my Ts/Fs to TRUE/FALSE.
> Given
>   F <- TRUE
>   T <- FALSE
> is it possible to forbid T to stand for TRUE, and F for FALSE in
>   function(...,something=T)?
> Or, alternatively, never allow F <- whatever and T <- whatever?
>

Allowing T and F to be used as variables is deliberate. R CMD check will 
check to see if you use T and F without defining them, which catches most 
examples.  This is done using makeActiveBinding, see the help to find out 
how you can use it yourself.

 	-thomas




More information about the R-help mailing list