I am quite new to R and I am having a problem checking some values for equality. I have a dataframe rt (below), and I wish to check whether the values in column r$V8 are equal to 606.
V1 V2 V3 V4 V5 V6 V7 V8 V9
710 256225 RAIN 1853-12-26 00:00 1 DLY3208 900 1 606 1001
712 256225 RAIN 1853-12-27 00:00 1 DLY3208 900 1 606 1001
714 256225 RAIN 1853-12-28 00:00 1 DLY3208 900 1 606 1001
716 256225 RAIN 1853-12-29 00:00 1 DLY3208 900 1 606 1001
718 256225 RAIN 1853-12-30 00:00 1 DLY3208 900 1 606 1001
720 256225 RAIN 1853-12-31 00:00 1 DLY3208 900 1 606 1001
> typeof(rt$V8)
[1] "integer"
> mode(rt$V8)
[1] "numeric"
> class(rt$V8)
[1] "factor"
> rt$V8
[1] 606 606 606 606 606 606
Levels: 606 1530
Test if equal to 606:
> rt$V8 == 606
[1] FALSE FALSE FALSE FALSE FALSE FALSE
> as.integer(rt$V8) == as.integer(606)
[1] FALSE FALSE FALSE FALSE FALSE FALSE
I do not understand why these checks return false, I would appreciate any advice please.