[R] setting breaks in hist

Stephen Ellison stephen.ellison at lgcgroup.com
Tue Jun 21 15:02:07 CEST 2011


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}}



More information about the R-help mailing list