[R] function which can apply a function by a grouping variable and also hand over an additional variable, e.g. a weight

Werner W. pensterfuzzer at yahoo.de
Fri Oct 1 13:05:47 CEST 2010


Hi,

I was wondering if there is an easy way to accomplish the following in R:
Often I want to apply a function, e.g. weighted.quantile from the Hmisc package 
to grouped subsets of a data.frame (grouping variable) but then I also need to 
hand over the weights which seems not possible with summaryBy or aggregate or 
the like.

Is there a function to do this? Currently I do this with loops but it is very 
slow.

I would be very grateful for any hints.

Thanks,
  Werner






More information about the R-help mailing list