0

I almost feel silly asking this question but I'm completely new to R and I just can't seem to figure this out.

For a vector v and v.2

v=c(0,0.9,1,1.1,1.3,2.3,2.8,3.0,5.0,5.9,6.0,8.2,9.8)
v.2=diff(v)
  [1] 0.9 0.1 0.1 0.2 1.0 0.5 0.2 2.0 0.9 0.1 2.2 1.6

I want to find which differences are smaller than 1 i.e. v.2<1

And I get this crazy output:

TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE FALSE FALSE

where apparently v.2[5]=1.0, but it's still registered as "true".

Why would this be the case?

V.B
  • 1

0 Answers0