[R] Median in Classes

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Mon Mar 21 11:13:08 CET 2005


you could try something like this:

dat <- data.frame(x=rep(1:4, each=25), y=rnorm(100))
tapply(dat$y, dat$x, summary)

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Hecht Michael, F+E/ST" <Michael.Hecht at dillinger.biz>
To: "'r-help at lists.R-project.org'" <r-help at stat.math.ethz.ch>
Sent: Monday, March 21, 2005 10:59 AM
Subject: [R] Median in Classes


> Hello,
>
> I've got a problem to find an effective calculation.
> There are x,y data and I want to build classes for
> the x values. For each class then I want to calculate
> the median, N%-Quantiles, outliers, etc. for the
> corresponding y values and store all in a vector or matrix.
>
> Is there a direct possibility to do this without
> storing to much temporary data?
>
> Thank's in advance,
>
> Michael Hecht
>
> -------------------------------------------------
> | Dipl.-Math. Michael Hecht
> | 66748 Dillingen / Germany
> | E-Mail : mailto:michael.hecht at dillinger.de
>
> ______________________________________________
> 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