Skip to content

Conditional Weighted Average (ddply or any other function)

3 messages · Punit Anand, John Kane

#
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!
#
oops - it should be MKT, I have been playing with a number of data
sets simultaneously.

ddply (dataread , .(Sector, FISCALYEAR), summarise,WROE=wavg(ROE,  MKT)))
On Fri, Mar 1, 2013 at 2:23 PM, John Kane <jrkrideau at inbox.com> wrote:
#
See my last post which crossed yours.  

John Kane
Kingston ON Canada
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!