Check out ?by

For example,

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

--

From:           Ajay Shah <[EMAIL PROTECTED]>

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?

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to