[R] Computing growth rate

Brijesh Mishra brijeshkmishra at gmail.com
Thu Dec 15 15:45:36 CET 2016

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,


On Thu, Dec 15, 2016 at 7:53 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>> On 15 Dec 2016, at 13:34, Brijesh Mishra <brijeshkmishra at 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

More information about the R-help mailing list