Skip to content
Prev 33268 / 398502 Next

breaks

Erin Hodgess wrote:
I think what you're looking for is ?cut:

R> xx = c(-2.0,  1.4, -1.2, -2.2,  0.4,  1.5, -2.2,  0.2, -0.4, -0.9)
R> cut(xx, breaks = c(-Inf, -2.2, -0.97, 0.27, 1.5, Inf))
  [1] (-2.2,-0.97] (0.27,1.5]   (-2.2,-0.97] (-Inf,-2.2]  (0.27,1.5]
  [6] (0.27,1.5]   (-Inf,-2.2]  (-0.97,0.27] (-0.97,0.27] (-0.97,0.27]
Levels: (-Inf,-2.2] (-2.2,-0.97] (-0.97,0.27] (0.27,1.5] (1.5,Inf]
R>

Regards,
Sundar