Dealing with numeric (decimal) dates in R?
<p>I have some numeric date data from Excel:</p>

<pre><code>&gt; df &lt;- data.frame(c(42613, 42612, 42614), c(42614.61, 42613.97, 42612.12))
&gt; names(df) &lt;- c("Closetime", "Opentime")
</code></pre>

<p>Both <code>Closetime</code> and <code>Opentime</code> are <code>numeric</code>. I want to preserve the hour/minute/second data from <code>OpenTime</code> and add the time '00:00:00' to every date in <code>Closetime</code>:</p>

<pre><code>&gt; df$Closetime &lt;- paste(as.Date(df$Closetime, origin = '1900-01-01'), c('00:00:00'))
</code></pre>

<p>Easy enough to do <code>Closetime</code>, but when I try using <code>lubridate::date_decimal</code> on <code>Opentime</code>, everything goes to hell.</p>

<pre><code>&gt; df$Opentime &lt;- date_decimal(df$Opentime)
&gt; df
            Closetime             Opentime
1 2016-09-02 00:00:00 42614-08-11 15:36:00
2 2016-09-01 00:00:00 42613-12-21 01:12:00
3 2016-09-03 00:00:00 42612-02-13 22:04:48
</code></pre>

<p>How can I get both <code>Opentime</code> and <code>Closetime</code> to be of the same type/format? I am eventually looking to be able to get the difference, in hours, between the times in each column, for reference.</p>