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

Hadley Wickham hadley at rice.edu
Fri Oct 1 14:49:38 CEST 2010


You might want to check out the plyr package.
Hadley

On Fri, Oct 1, 2010 at 6:05 AM, Werner W. <pensterfuzzer at yahoo.de> wrote:
> 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
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list