Dear R users,

I have a surprising problem while selecting values in a sequence created 
with the seq() function...
I've tried a lot of test before sending this here and hope I did not 
disturb you for a foolish mistake from me

Please, have a look at the following lines:
#_______________________________________________________________________
 > test2<-seq(from=0,to=1,by=.1)
 > test2
 [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
 > test2==1
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
 > test2==0.9
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
 > test2==0.8
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
 > test2==0.7
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.6
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.5
 [1] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE
 > test2==0.4
 [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.3
 [1] FALSE FALSE FALSE  FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.2
 [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.1
 [1] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 > test2==0.0
 [1]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 >
# there is a problem with values 0.3, 0.6 and 0.7 impossible to select 
in such a vector...
# the same thing happens with other sequence including somme of these values

test3<-seq(from=0,to=1,by=0.01)
test3
test3==0.3   # not working
test3==0.6   # working
test3==0.7   # not working
#________________________________________________________________________

Does anyones has an explanation and a solution ?

Kind regards

Ben




        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to