problems with hist()
As a last resort, try read the help page:
A numerical tolerance of 1e-7 times the range of the breaks is
applied when counting entries on the edges of bins.
If you use a silly range, this will affect your results.
On Tue, 20 May 2003, Guenter Tirler wrote:
Hi, I try to compute the counts of a histogram of random numbers. But I get different results depending on the limits (-10,10) or (-1000,1000) although all numbers are in the interval (-10,10). Have I done somthing wrong?
x<-rnorm(1e6) s1<-hist(x, br =c(-1000,-1,-0.5,0,0.5,1,1000),plot=FALSE)[[2]] s2<-hist(x, br =c(-10,-1,-0.5,0,0.5,1,10),plot=FALSE)[[2]] sum(s1)
[1] 1000000
sum(s2)
[1] 1000000
s1
[1] 159035 149461 192003 191478 149789 158234
s2
[1] 159009 149452 192004 191464 149805 158266
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595