Re: [R] figure out whether 1 is between two numbers

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Sun 19 Feb 2006 - 21:16:58 EST


On 18-Feb-06 Duncan Murdoch wrote:
> On 2/18/2006 1:13 AM, Robert W. Baer, Ph.D. wrote:

>> Try:
>> (X>1 & Y<1) | (X<1 & Y>1)

>
> This is a minor stylistic suggestion: when translating the
> mathematical expression (a < b < c), write it as
> (a < b) & (b < c). It has no effect on the outcome, but
> keeping the inequalities in the same direction makes
> the meaning more obvious.
>
> If you do this, your expression becomes
>
> (Y<1 & 1<X) | (X<1 & 1<Y)
>
> and it's clear at a glance what's going on.

And, as a follow-up, can I suggest for ultimate clarity [ :) ]

  (X<1 | Y<1) & (1<X | 1<Y)

Ted.



E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 19-Feb-06                                       Time: 10:16:55
------------------------------ XFMail ------------------------------

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Feb 19 21:22:18 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:46 EST