Yes, Mr Hasselman. This works like charm now. I also realise where I was making an error. Now I have two very good options to choose from. Spoilt for choices...
Many Many Thanks, Brijesh On Thu, Dec 15, 2016 at 7:53 PM, Berend Hasselman <b...@xs4all.nl> wrote: > >> On 15 Dec 2016, at 13:34, Brijesh Mishra <brijeshkmis...@gmail.com> wrote: >> >> Dear Mr Hasselman, >> >> I missed you mail, while I was typing my own mail as a reply to Mr. >> Barradas suggestion. In fact, I implemented your suggestion even >> before reading it. But, I have a concern that I have noted (though its >> only hypothetical- such a scenario is very unlikely to occur). Is >> there a way to restrict such calculations co_code1 wise? > > Like this? > > df2 <- ddply(df1,"co_code1", transform, > growth=c(NA, ifelse(diff(fyear1)==1, (exp(diff(log(sales1)))-1)*100,NA)) > ) > > > But do also look at Petr Pikal's solution. Which of the two solutions you > prefer depends on what you want in your special case. > > Berend ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.