Skip to content
Prev 318532 / 398503 Next

Conditional Weighted Average (ddply or any other function)

It is not at all clear what you are doing.  You state that the data set you are using is what I have called dat1 : see dput form below.

As far as I can see there is no numerical value in there.  

##===========data set in dput form================#
dat1  <-  structure(list(Name = c("N1", "N1", "N1", "N1", "N1", "N1", "N1", 
         "N2", "N2", "N2", "N2", "N2", "N2", "N2"), Ticker = c("T1", "T1", 
         "T1", "T1", "T1", "T1", "T1", "T2", "T2", "T2", "T2", "T2", "T2", 
         "T2"), Sector = c("S1", "S1", "S1", "S1", "S1", "S1", "S1", "S2", 
          "S2", "S2", "S2", "S2", "S2", "S2"), Industry = c("I1", "I1",                                                                                     "I1", "I1", "I1", "I1", "I1", "I2", "I2", "I2", "I2", "I2", "I2", 
          "I2"), Country = c("C1", "C1", "C1", "C1", "C1", "C1", "C1", 
           "C2", "C2", "C2", "C2", "C2", "C2", "C2"), Year = c("FY-4", "FY-3", 
          "FY-2", "FY-1", "FY0", "FY1", "FY2", "FY-4", "FY-3", "FY-2", 
          "FY-2", "FY0", "FY2", "FY2"), ROE = c("ROE11", "ROE12", "ROE13", 
          "ROE14", "ROE15", "ROE16", "ROE17", "ROE21", "ROE22", "ROE23", 
          "ROE24", "ROE25", "ROE26", "ROE27"), EPS = c("EPS11", "EPS12", 
          "EPS13", "EPS14", "EPS15", "EPS16", "EPS17", "EPS21", "EPS22", 
          "EPS23", "EPS24", "EPS25", "EPS26", "EPS27"), MKTCAP = c("MKT11", 
          "MKT12", "MKT13", "MKT14", "MKT15", "MKT16", "MKT17", "MKT21", 
          "MKT22", "MKT23", "MKT24", "MKT25", "MKT26", "MKT27")), .Names = c("Name", 
         "Ticker", "Sector", "Industry", "Country", "Year", "ROE", "EPS", 
         "MKTCAP"), class = "data.frame", row.names = c(NA, -14L))
## =================end of dataset==================#

There is no FISCALYEAR variable that you specifed below
I think we need a bit more information. 

John Kane
Kingston ON Canada
____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails