[Bioc-devel] Reminder about & vs && and | vs ||

Seth Falcon sfalcon at fhcrc.org
Fri Aug 31 20:30:46 CEST 2007


Hello package maintainers,

Looking through the BioC sources I see many cases where the vectorized
logical operators | and & are being improperly used inside if().

The general rule is that inside an if() you want to use && and ||
because these return a logical value of length one.

When you want a vectorized logical operation, use | and &.  A warning
will be raised if you use & or | inside an if and the returned vector
has length greater than one.  So misuse will be noisy.

Please consider reviewing your package code and applying appropriate
fixes.

+ seth


-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
BioC: http://bioconductor.org/
Blog: http://userprimary.net/user/



More information about the Bioc-devel mailing list