[R] Department of Redundancy Department.

Greg Snow Greg.Snow at imail.org
Fri Aug 15 22:51:14 CEST 2008


Look at:

> library(fortunes)
> fortune(69)


--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111



> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Rolf Turner
> Sent: Thursday, August 14, 2008 4:07 PM
> To: R-help Forum
> Subject: [R] Department of Redundancy Department.
>
>
> 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 at 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.
>



More information about the R-help mailing list