title: Time between Vector dates in R
body: <p>Given a vector of dates, V.dates, write a function that determines the time, in days, from present day for each element.  Next determine the quarter, as defined by 91 day segments, from present day in reverse chronological order.  Define quarter '0' to be the time between present day and (present day - 91), quarter '1' to be (present day - 91) to (present day - 182), etc. Lastly, return a data frame that contains the original date, the duration from present day, and the quarter to which the date belongs.  Keep in mind that dates may be before or after present day.  For example, assuming present day is '10/27/2010' and an input date of '6/20/2009', the function should return that the input date is 494 days from present day and belongs in quarter 5.</p>
  
  <p>I have currently worked out the time between the two vectors using: </p>
  
  <pre><code>V.dates &lt;- as.Date(c("27-10-2010","20-6-2009"),format="%d-%m-%Y")
  difftime(V.dates[1],V.dates[2],units="days")
  </code></pre>
  
  <p>I am lost on how to determine the quarter.</p>