I think the answer is in this line in hist.default(): breaks <- pretty(range(x), n = breaks, min.n = 1)
> length(pretty(c(1:1000), 100)) [1] 101 > length(pretty(c(1:1000), 200)) [1] 201 > length(pretty(c(1:1000), 250)) [1] 201 > length(pretty(c(1:1000), 300)) [1] 201 > length(pretty(c(1:1000), 500)) [1] 501 Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glenn Lawyer Sent: 27 August 2008 13:27 To: r-help@r-project.org Subject: [R] Odd behavior in histogram breaks? I am looking at histogram breaks, and notice something odd: > foo <- hist(runif(10000),breaks=20) > length(foo$breaks) [1] 21 This makes sense to me. > foo <- hist(runif(10000),breaks=200) > length(foo$breaks) [1] 201 This also makes sense. BUT > foo <- hist(runif(10000),breaks=250) > length(foo$breaks) [1] 201 > foo <- hist(runif(100000),breaks=250) > length(foo$breaks) [1] 201 Why only 201 breaks? Where did the other 50 go? -- ------------------------------------ Here miracles become marvels, and marvels recurring wonders. -- William Beebe Dr. Glenn Lawyer +352 661 967 244 Instituttgruppe for psykiatri Seksjon Vinderen PB 85 Vinderen 0319 Oslo http://folk.uio.no/davidgl [[alternative HTML version deleted]] ______________________________________________ R-help@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. *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the=2...{{dropped:22}} ______________________________________________ R-help@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.