title: Looping through date in R loses format
body: <p>This has been frustrating me. Even with <code>lubridate</code> I can't get dates to maintain their type when I loop over them. For example:</p>
  
  <pre><code>require(lubridate)
  yearrange = ymd(20110101) + years(seq(4))
  yearrange
  #[1] "2012-01-01 UTC" "2013-01-01 UTC" "2014-01-01 UTC" "2015-01-01 UTC"
  class(yearrange)
  #[1] "POSIXct" "POSIXt" 
  </code></pre>
  
  <p>However, if I try to loop through years (creating a separate plot for each year in my data set): <strong>I lose the formatting of the year, and would have to re-cast the data</strong></p>
  
  <pre><code>for (yr in yearrange) { show(yr) }
  #[1] 1325376000
  #[1] 1356998400
  #[1] 1388534400
  #[1] 1420070400
  </code></pre>
  
  <p>If I loop though specifying indices, I get date objects back:</p>
  
  <pre><code>for (i in seq(length(yearrange))) { show(yearrange[i]) }
  #[1] "2012-01-01 UTC"
  #[1] "2013-01-01 UTC"
  #[1] "2014-01-01 UTC"
  #[1] "2015-01-01 UTC"
  </code></pre>
  
  <p>Is there an easy way to avoid the indexed option, without using <code>foreach</code>, or is that the only way?</p>