Skip to content
Prev 318546 / 398503 Next

Conditional Weighted Average (ddply or any other function)

Okay I got the data but you seem to have an undefined variable in wavg.
You write :
ddply (dataread , .(Sector, FISCALYEAR), summarise,WROE=wavg(ROE,  MKTCAP)))

There is no MKTCAP in the data.frame.  Also there is one too many ) in the equation: I think you mean :
ddply (dataread , .(Sector, FISCALYEAR), summarise,WROE=wavg(ROE,  MKTCAP))

Have you left out a equation that calculates  MKTCAP?

John Kane
Kingston ON Canada
____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!