Computing growth rate
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