Dear R People: Is there a way to "guarantee" that breaks=n will give you exactly n breaks, please? I'm fairly certain that the answer is "no", but thought I'd check. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
The way to guarantee a specific number of panels in the histogram, say n, is to specify n+1 breaks which cover the range of the data. As far as I know this is the only way. Bill Venables. -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Erin Hodgess Sent: Tuesday, 21 June 2011 10:17 AM To: R help Subject: [R] setting breaks in hist Dear R People: Is there a way to "guarantee" that breaks=n will give you exactly n breaks, please? I'm fairly certain that the answer is "no", but thought I'd check. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Not according to the help page.
Bit kludgy,but try something like
y <- rnorm(73, 17.2)
nbreaks <- function(x, n) {
r <- range(pretty(y))
seq(r[1], r[2], length.out=n+1)
}
hist(y, breaks=nbreaks(y,13))
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Erin Hodgess
> Sent: 21 June 2011 01:17
> To: R help
> Subject: [R] setting breaks in hist
>
> Dear R People:
>
> Is there a way to "guarantee" that breaks=n will give you
> exactly n breaks, please?
>
> I'm fairly certain that the answer is "no", but thought
I'd check.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences University
> of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> *******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}