Calculate Growth Rate

#1
I am not a math major and I have not done development in R before so please take this into account when reading my question.

I currently having a program written in C# that calculates historical growth rates for companies using the Compounded annual growth rate formula. I then use this growth rate to guess future growth rates.

I have quarterly data for the past 10 years. Currently I take the data from 10 years ago and then take the data from the most recent year and use the CAGR formula to calculate a growth rate. This isn't very accurate because if the data from 10 years ago or the data from the most recent year is skewed then it messes up the whole calculation.

I am looking for something that takes all of the data from the past 10 years into account to calculate a historical growth rate.

It seems like the R programming language would be perfect for doing something like this but I don't know where to start.

Any help would be greatly appreciated.

Thanks!