[R] hist function to give each cell equal area

Roger Bivand Roger.Bivand at nhh.no
Fri Jan 7 12:01:36 CET 2005


On Fri, 7 Jan 2005, Dan Bolser wrote:

> 
> Hi,
> 
> I want to use hist with non-equi-spaced breaks, picked such that the
> fraction of the data points falling in the cells (defined by 'breaks') is 
> roughly equal accross all cells.

?quantile

> 
> Is there such a function that will automatically try to determine the
> breaks to fullfill this requirement?
> 
> Something like..
> 
> hist( x, br = magic_function_to_pick_breaks())
> 
> 
> For example, if x looked like this...
> 
> x <- c( 1:5, 10+1:5, 100+1:5 )
> 
> the breaks would define cells like this 
> 
> hist(x,breaks=c(0,5,15,105))

hist(x, quantile(x, seq(0,1,1/3)))

isn't the same, but your breaks are arbitrary and based on knowing where 
the gaps are.

> 
> Is there such a function?
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list