[R] hist clarification

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue May 20 21:11:30 CEST 2008


On 5/20/08, John Gant <john.gant at gmail.com> wrote:
> Can someone help me with a misunderstanding I'm having with hist? I
>  expected, from the example below, that the number of bins would always be 10
>  and the length of the counts array the same. According to the help section
>  'breaks' can be a integer indicating the number of bins.

The help actually says:

  breaks: one of:

             *  a vector giving the breakpoints between histogram
                cells,

             *  a single number giving the number of cells for the
                histogram,

             *  a character string naming an algorithm to compute the
                number of cells (see 'Details'),

             *  a function to compute the number of cells.

          In the last three cases the number is a suggestion only.

The last sentence explains your observation.

BTW, this was recently discussed:

https://stat.ethz.ch/pipermail/r-help/2008-May/162492.html

-Deepayan



More information about the R-help mailing list