I just noticed a certain ``usage'' in a recent posting, and couldn't
restrain my self from commenting.  The usage was of the form

        ``if(X==TRUE)''

where X was a logical variable.

This sort of thing is brought to you by your Department of Redundancy
Department. The ``==TRUE'' bit is irrelevant, incompetent, and immaterial,
as Perry Mason used to say.  The value of X==TRUE is exactly the same as
the value of X when X is a logical variable. If X is not a logical variable
a lot of strange things can happen, depending on the nature of X.

It is safer and takes 6 fewer key strokes to use ``if(X)''.  So why not
do that, eh?

        cheers,

                Rolf Turner

P. S.  The example that triggered this post actually used ``if(X==T)''.
This is doubly dangerous since ``T'' can be overwritten.  If it was
overwritten you'd get toadally wrong answers.  E.g., suppose you had
set

        T <- FALSE   # !!!

***ALWAYS USE ``TRUE'' AND ``FALSE'' FOR LOGICAL VALUES.
   DO NOT USE ``T'' AND ``F''.***

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to