[R] Question about manipulating quartiles

Gabor Grothendieck ggrothendieck at myway.com
Sat Jul 31 09:36:50 CEST 2004



Check out ?by

For example,

   data(iris)
   by(iris, quantcut(iris[,1]), function(x) sum(x[,1]/x[,2]))

--

From:   	Ajay Shah <ajayshah at mayin.org>

I know the `quantcut' function in the gregmisc package, and using it,
I'm able to use functions like aggregate to compute the mean or sd()
in each quartile.

What if I have a data frame containing x and y, and I want to make
quartiles by x, but then compute sum x / sum y in each quartile?
How does one persuade aggregate to do this?




More information about the R-help mailing list