I need to compute weighted descriptive statistics (mean, median, variance) for a vector of data disaggregated by a set of index variables. The weights to be used are vector in the same data frame and have to be disaggregated by the same index variables.
Package Hmisc has functions for computing weighted statistics. But both by/aggregate and summarise (in Hmisc) allow a function to have only a simgle argument. In my case, I need to specify by the variable and the weights as argument to the function. Could anyone please advice how to do it. As an example, say I have a data.frame giving incomes of persons in different towns along with weights to be given for each sampled person. How will I compute weighted statistics for each town? Vikas Rawal JNU, New Delhi. ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.