title: For R, how do I determine the origin when there is an error in running POSIXct
body: <p>There is an error thrown saying that I did not specify an origin - I thought the origin was automatically 1970-01-01 00:00:00 and that I do not need to specify. Code worked before when coworker wrote it. How do I correct this error? Below is the partial code (I can post the full script too if that's helpful)</p>
  
  <p>Sample Data csv:</p>
  
  <blockquote>
    <p>YEARMONTH,COUNT,ZONE,DOMAIN</p>
    
    <p>2011-04-01 00:00:00,1786,City1,Domain1</p>
    
    <p>2011-05-01 00:00:00,1762,City1,Domain1</p>
    
    <p>2011-06-01 00:00:00,1932,City1,Domain1</p>
  </blockquote>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>Error in as.POSIXct.numeric(index(dfplot)) : 'origin' must be supplied</p>
  </blockquote>
  
  <p>R Code (for errorred code, go to comment <strong>#Nicely Plot the Data</strong>):</p>
  
  <pre><code>  # Plot
  
    ######################################
  
    #Merge Time Series and Export Data
  dfplot &lt;- merge(as.xts(InputDataTimeSeries), as.xts(pred$lower))
  dfplot &lt;- merge(dfplot, as.xts(pred$mean))
  dfplot &lt;- merge(dfplot, as.xts(pred$upper))
  dfplot &lt;- merge(dfplot, as.xts(pred$fitted))
  
  names(dfplot)[1:7] &lt;- c("actuals", "lower80", "lower95", "predicted", "upper80", "upper95", "fitted")
  
  #Nicely Plot the Data
  ggplot(dfplot, aes(x=as.POSIXct(index(dfplot)))) +
  geom_line(aes(y=fitted), col='grey90', size = 2) +
  geom_line(aes(y=predicted), col='orange', size= 1) +
  geom_line(aes(y=actuals), col='orange', size= 1) +
  
  geom_ribbon(aes(ymin=lower80,ymax=upper80),alpha=0.3, fill="orange") +
  geom_ribbon(aes(ymin=lower95,ymax=upper95),alpha=0.1, fill="orange") +
  theme_bw() +
  geom_vline(xintercept=as.numeric(as.POSIXct(end(InputDataTimeSeries))), linetype="dashed", fill="gray40") +
  labs(title=paste(pred$method, "80/95% PI Bands" ) , x="Time", y="Observed / Fitted") +
  theme(plot.title = element_text(size=18, face="bold"))
  </code></pre>