title: Looping for all columns in R
body: <p>I am trying to loop this code for all my columns where the column names are 1,2,3,4,5</p>
  <pre><code>MoM1 &lt;- (Data$1-lag(Data$1)) /lag(Data$1)
  </code></pre>
  <p>How do I loop this code for columns 2,3,4 and 5 instead of doing</p>
  <pre><code>MoM1 &lt;- (Data$1-lag(Data$1)) /lag(Data$1)
  MoM2 &lt;- (Data$2-lag(Data$2)) /lag(Data$2)
  ...
  </code></pre>