How to change the number of bins in "hist" function?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to change the number of bins in "hist" function?

LosemindL
Hi all,

I am doing histogram using the "hist" function. For some reason, the
histogram does not look good... is there a way I can change the number of
bins, and/or change the way that data gets binned... so that I can obtain a
better looking histogram?

Thanks a lot!

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How to change the number of bins in "hist" function?

Wincent
?hist will tell you
...
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.



2006/2/17, Michael <[hidden email]>:

> Hi all,
>
> I am doing histogram using the "hist" function. For some reason, the
> histogram does not look good... is there a way I can change the number of
> bins, and/or change the way that data gets binned... so that I can obtain a
> better looking histogram?
>
> Thanks a lot!
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
黄荣贵
Deparment of Sociology
Fudan University


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html