title: correctly lagging with irregularly spaced data
body: <p>I have some irregularly spaced data, say table A. The frequency is every 2-5 days. I have another data set, table B, which has entries for every weekday. I want to run the following regression:</p>
  
  <p>A_{t} = alpha + beta1 * B_{t-2 months} + error</p>
  
  <p>where, when I lag B, if there isn't something that isn't exactly 60 days ago, e.g. if 60 days ago was a Sunday, then just pick the next Monday. I can of course construct this w/ a for loop, but what is the R way. Currently, the data are store in MySQL tables and I am using RMySQL to access.</p>
  
  <p>Thanks for the help.</p>