title: How to create lag variables
body: <p>I want to create lagged variable for a variable pm10 and used the following code. However, I could not get what I wanted. How could I create a lag of pm10?</p>
  
  <pre><code>df2$l1pm10 &lt;- lag(df2$pm10, -1, na.pad = TRUE)
  df2$l1pm102 &lt;- lag(df2$pm10, 1)
  
  dput(df2)
  structure(list(var1 = 1:10, pm10 = c(26.956073733, NA, 32.838694951, 
  39.9560737332, NA, 40.9560737332, 33.956073733, 28.956073733, 
  32.348770798, NA), l1pm10 = structure(c(26.956073733, NA, 32.838694951, 
  39.9560737332, NA, 40.9560737332, 33.956073733, 28.956073733, 
  32.348770798, NA), .Tsp = c(2, 11, 1))), .Names = c("var1", "pm10", 
  "l1pm10"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", 
  "9", "10"), class = "data.frame")
  </code></pre>