Imagine there are 100 columns, some of them categorical and most of them numerical. One of the column is Year.
I want to create a different dataset which shows the growth rate for each of the column. For example, if column one is Sales, I need sales growth rate; column two is income, I need corresponding Income growth rate. Please note there are 100 columns, so I am not looking to manually check growth rate for each column. I am assuming some sort of for loop is required.
#Here is an example for one column
Diff_year <- growthFund$Year - lag(growthFund$Year)
Diff_growth <- Sales - lag(Sales)
Rate_percent <- (Diff_growth / Diff_year)/Sales * 100