[R] how to specify bin width in hist()

Jim Lemon jim at bitwrit.com.au
Thu Oct 4 12:04:47 CEST 2007

Abu Naser wrote:
> Hi all user,
> I have been wondering how the bin width can be specified in hist().

Hi Abu,

If you want constant bin widths (e.g. from 0 to 10), it's easy:


and the "by" argument is your width. If you want completely customized 
bin widths (which may not be a great idea):


also look at the right= argument to decide whether to include the lower 
or higher break value in each bin.


More information about the R-help mailing list