I am trying to do a \"group by\" - style weighted mean in R. With some basic mean the following code (using the plyr package from Hadley) worked well.
ddply
Use summarise (or summarize):
ddply(iris, "Species", summarise, wmn = weighted.mean(Sepal.Length, Petal.Length), mn = mean(Sepal.Length))