From: Itay Furman <itayf_at_u.washington.edu>

Date: Thu 07 Apr 2005 - 15:31:05 EST

R-help@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 Received on Thu Apr 07 15:35:34 2005

Date: Thu 07 Apr 2005 - 15:31:05 EST

On Wed, 6 Apr 2005, Rich FitzJohn wrote:

[snip]

> ## This does the hard work of calculating the statistics over your

*> ## combinations, and over the values in `p'
**> y <- lapply(p, function(y)
**> tapply(df$r, list(a=a, x=x), quantile, probs=y))
**>
*

Rich, thank you for your reply. Gabor G has proposed a different solution that seem to me to be easier to maintain and scale up. Please see my follow up to his reply.

Your solution introduced to me some R functions I was not familiar with: expand.grid(), colSums(), and names(). Thanks for that, too.

> ## Then, we need to work out what combinations of a & x are possible:

*> ## these are the header columns. aggregate() does this in a much more
**> ## complicated way, which may handle more difficult cases than this
**> ## (e.g. if there are lots of missing values points, or something).
**> vars <- expand.grid(dimnames(y[[1]]))
*

In Gabor G's solution this is magically done (I think!) by do.call().

Thanks, Itay ----------------------------------------------------------------itayf@u.washington.edu / +1 (206) 543 9040 / U of Washington

R-help@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 Received on Thu Apr 07 15:35:34 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:03 EST
*