title: Getting the last day of the previous year in R?
body: <p>So the question is how to select the last day of the previous year. I want to set this up to be automatic, cause we might do it for a couple of years. </p>
  
  <p>What I have set up already is this : </p>
  
  <pre><code>lastyear &lt;- as.numeric(format(today, "%Y")) - 1
  </code></pre>
  
  <p>Today is just an object with Sys.Date() in it so I don't believe I need to provide code for that? (It's in the format of a date if anyone really wants to know.) </p>
  
  <p>The code I have above gets the previous year fine, but I want something that picks out "2014-12-31" for me. </p>
  
  <p>So, the question repeated would be how can I <strong><em>automatically</em></strong> pick out the last day of the previous year? </p>
  
  <p>Also, I use lubridate in this script. </p>