0

it's mi first question Im having trouble when comparing an array, colum value, etc with number 0.7 in R I've found some questions which includes this value, but not related to this apparet "bug"

As example

f<-(1:9)*0.1

f==0.8
#[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
#or 
which(f==0.8)
#[1] 8

#as expected, but when it's 0.7 
f==0.7
#[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

which(f==0.7)
#integer(0)

Although it can be 'solved' quoting the value ...

which(f=='0.7')
#[1] 7

may it be a bug?

Sotos
  • 51,121
  • 6
  • 32
  • 66
Julian M
  • 21
  • 3

0 Answers0