[R] mean for every quartile

chalabi.elahe at yahoo.de chalabi.elahe at yahoo.de
Mon May 16 14:31:06 CEST 2016


Hi all,
I have a column in my df and I want to get quartiles for this column and then calculate mean for each and every quartile, here is my column:


    df$BR 
    [1] 384 384 384 384 512 384 384 320 320 320 320 320 320 320 320 320 320 384 
    [19] 384 384 320 320 320 320 384 384 256 320 320 320 384 320 320 320 384 384 
    [37] 320 320 320 320 320 320 320 320 320 384 320 320 320 320 320 320 384 320 
    [55] 320 320 320 320 320 320 384 512 320 320 320 320 320 320 320 384 384 320 
    [73] 320 320 384 320 320 320 320 256 320 320 384 320 384 320 384 320 320 320 
    [91] 384 320 320 320 320 320 320 320 320 320 320 320 

I do the following to get the quartiles:

    
    quantile(m$BR) 
    0%  25%  50%  75% 100% 
    256  320  320  368  512

now how can I get mean for each quartile?
Thnaks for any help,
Elahe



More information about the R-help mailing list