Binning data for histogram

  • Follow


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!
0
Reply Tiffany 4/7/2010 3:19:56 PM

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@gmail.com> wrote in message 
news:a90045c9-9d98-4d4e-ab34-4ec4305baa92@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! 

0
Reply Mark 4/10/2010 1:36:15 PM


1 Replies
631 Views

(page loaded in 0.035 seconds)

Similiar Articles:













7/22/2012 8:02:13 AM


Reply: