title: Calculation with apply
body: <p>I have one table with five columns Year,Revenue,Pensions,Income and Wages.With this table I made calculation with code below:</p>
  
  <pre><code>library(dplyr)
  #DATA
  TEST&lt;-data.frame(
    Year= c(2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021),
    Revenue =c(8634,5798,6022,6002,6266,6478,6732,7224,6956,6968,7098,7620,7642,8203,9856,20328,22364,22222,23250,25250,26250,27250),
    Pensions =c(8734,5798,7011,7002,7177,7478,7731,7114,7957,7978,7098,7710,7742,8203,9857,10328,11374,12211,13150,15150,17150,17150),
    Income =c(8834,5898,6033,6002,6366,6488,6833,8334,6956,6968,8098,8630,8642,8203,9856,30328,33364,32233,33350,35350,36350,38350),
    Wages =c(8834,5598,8044,8002,8488,8458,8534,5444,8958,8988,5098,5840,5842,8203,9858,40328,44384,42244,43450,45450,48450,45450)
      )
  
  #FUNCTION
  fun1 &lt;- function(x){ ((x - lag(x))/lag(x))*100}
  
  #CALCULATION
  ESTIMATION_0&lt;-mutate(TEST,
                       Nominal_growth_Revenue=fun1(Revenue),
                       Nominal_growth_Pensions=fun1(Pensions),
                       Nominal_growth_Income=fun1(Income),
                       Nominal_growth_Wages=fun1(Wages)
                        )
  </code></pre>
  
  <p>But my intention is to optimize this code and to do this calculation with apply function (or something similar). Namely for this calculation I wrote 4 code line, but I like to do this with one code line. So can anybody help me with this problem ?</p>