Skip to content
Prev 332747 / 398506 Next

R 3.0.2 - How to create intervals and group another variable in those intervals?

Is this what you are after:
+             , spacing = rnorm(n)
+             )
(0,4.5]     (4.5,9]    (9,13.5]   (13.5,18]   (18,22.5]
(22.5,27]   (27,31.5]   (31.5,36]
 0.27840783 -0.08349567 -0.10659408 -0.01476840 -0.08773255
-0.06643826  0.21873016  0.17627232
  (36,40.5]   (40.5,45]   (45,49.5]   (49.5,54]   (54,58.5]
(58.5,63]   (63,67.5]   (67.5,72]
-0.16568350 -0.15458191 -0.04909331 -0.01179396  0.25022296
-0.27553812 -0.14927483 -0.21000177
  (72,76.5]   (76.5,81]   (81,85.5]
-0.09884137 -0.08459709  0.02864456
plotting is left as an exercise for the reader, but given the averages
above, you can find the midpoints easily.

Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Wed, Nov 6, 2013 at 10:48 AM, umair durrani <umairdurrani at outlook.com> wrote: