I'm looking for something similar in form to weighted.mean(). Sorry for posting such a banal question... new to R. I've found some solutions via search that write out the entire function but would appreciate something a bit more user friendly.
+10
A:
The following packages all have a function to calculate a weighted median: 'aroma.light', 'isotone', 'limma', 'cwhmisc' and 'ergm'.
To find them I used the invaluable findFn() in the 'sos' package which is an extension for R's inbuilt help.
findFn('weighted median')
Or,
???'weighted median'
as ??? is a shortcut in the same way ?some.function
is for help(some.function)
wkmor1
2010-05-01 04:26:22
I didn't know about findFn! That's awesome!
Bob Albright
2010-05-01 05:39:21
You can also use ??? as you use ? or ??, still from sos package.
Etiennebr
2010-05-01 12:51:55
Agreed on the findFn. Very useful. And rather than install a new package I just got some sleep. I'm just trying to calculate the median of weighted data and did this: median(rep(x, each=w)).
Michael Williams
2010-05-01 14:09:01
Yep, median(rep(x, each=w)), would work too. But only if all your weights are integers.
wkmor1
2010-05-01 23:35:04