Skip to content

About basic logical operators

5 messages · Victor hyk, Jeff Newmiller, Anthony Damico +2 more

#
faq 7.31
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Victor hyk <victor_hyk at yahoo.ca> wrote:

            
#
On 05/03/2013 7:53 PM, Victor hyk wrote:
You don't have a 0.02 in your dataset.  Evaluate x[52] - 0.02 and you 
won't get zero due to rounding (as Jeff said, see FAQ 7.31).
You don't have 0.2, either.  Evaluate x[61] - 0.2 and you get a negative 
value.

Duncan Murdoch
#
This is a bit off the original topic, but you should really put spaces around the "<".
Otherwise you might be surprised when you compare x to -0.2 instead of +0.2:
   > x<-seq(-1,1,by=0.02)
   > x[x<-0.2] 
   numeric(0)
   > x
   [1] 0.2


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com