title: Calculate percentage change in an R data frame
body: <p>I have a time series object in R with multiple vectors. I would like to calculate the period-over-period percentage change at each point in time (save t = 1, which would obviously be NA) for each vector.</p>
  
  <pre><code>&gt; data &lt;- ts(data.frame(x1=c(1:10), x2=c(11:20), x3=c(21:30)), start = c(2010,3), frequency = 4)
  &gt; data
          x1 x2 x3
  2010 Q3  1 11 21
  2010 Q4  2 12 22
  2011 Q1  3 13 23
  2011 Q2  4 14 24
  2011 Q3  5 15 25
  2011 Q4  6 16 26
  2012 Q1  7 17 27
  2012 Q2  8 18 28
  2012 Q3  9 19 29
  2012 Q4 10 20 30
  </code></pre>