I have a dataset in R which is structured as below
Headers:
ClientID Geo Industry RevBiz1_09 RevBiz1_10 RevBiz1_11 RevBiz1_12 RevBiz2_09 RevBiz2_10 RevBiz2_11 RevBiz2_12...
What I want to do is write a function in R that starts with column 4 and goes through each set of 4 columns, calculates CAGR and generates a new column with that value for the respective Biz. What I am having trouble doing is figuring out how to write the loop.
Any help would be greatly appreciated.