Message-ID: <16998.19321.721843.366453@stat.math.ethz.ch>
Date: 2005-04-20T12:30:49Z
From: Martin Maechler
Subject: if(foo == TRUE) .. etc
In-Reply-To: <NEBBIPHDAMMOKDKPOFFIAENPDDAA.abunn@whrc.org>
>>>>> "Andy" == Andy Bunn <abunn at whrc.org>
>>>>> on Tue, 19 Apr 2005 10:27:04 -0400 writes:
.....
Andy> is.tuesday <- as.POSIXlt(Sys.time())$wday == 2
Andy> if (is.tuesday == T) { ....}
.....
aaah, this really hurts my eyes or rather the brain behind!
And it's by far not the first such instance...
Rather use " if (is.tuesday) { .... } "
More generally, please, please, everyone :
Replace
if (something == TRUE)
with if (something)
and
if (something.or.other == FALSE)
with if (!something.or.other)
{and even more for cases where you have
'T' and 'F' instead of 'TRUE' and 'FALSE' -
which is against all recommendations, since
F <- TRUE
T <- FALSE
are valid statements, probably not common, but think what
happens when you accidentally have the equivalent of "T <- 0"
somewhere in your global enviroment!
}
Martin Maechler, ETH Zurich