[R] hist function to give each cell equal area

BXC (Bendix Carstensen) bxc at steno.dk
Fri Jan 7 11:31:49 CET 2005


how about:

x <- rnorm(400)
nbin<-7
hist(x,breaks=quantile(x,prob=seq(0,1,length=nbin+1)))

Bendix Carstensen
----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
bxc at steno.dk
www.biostat.ku.dk/~bxc
----------------------



> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Dan Bolser
> Sent: Friday, January 07, 2005 11:21 AM
> To: R mailing list
> Subject: [R] hist function to give each cell equal area
> 
> 
> 
> 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.
> 
> 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))
> 
> 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
>




More information about the R-help mailing list