From: Tiffany on
Hello,

I am struggling with a way to create bins for a variable containing
length data. I would like to create 10cm bins from 0 to the maximum
length. I would then like to plot count data as a histogram by these
length bins.

the data look like this:
length count
12 1
13 5
22 2
24 1
26 3
720 2

thank you for any suggestions!
From: Mark Fisher on
You can easily create bins of any size with the mod function. This example
creates 10 cm bins, but to create 5 cm bins change 10 to 5, etc.

length_bin=length - mod(length,10);

Mark

"Tiffany" <tiffany.vidal(a)gmail.com> wrote in message
news:a90045c9-9d98-4d4e-ab34-4ec4305baa92(a)k13g2000yqe.googlegroups.com...
> Hello,
>
> I am struggling with a way to create bins for a variable containing
> length data. I would like to create 10cm bins from 0 to the maximum
> length. I would then like to plot count data as a histogram by these
> length bins.
>
> the data look like this:
> length count
> 12 1
> 13 5
> 22 2
> 24 1
> 26 3
> 720 2
>
> thank you for any suggestions!