Skip to content
Prev 366112 / 398502 Next

Computing growth rate

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