title: Converting a time decimal/fraction representing days to its actual time in R?
body: <p>I have a column in R on my dataset with values that have been converted into what I believe is a time decimal fraction based on <em>days</em>. I have been using this site as a reference: <a href="http://www.calculatorsoup.com/calculators/time/decimal-to-time-calculator.php" rel="nofollow noreferrer">http://www.calculatorsoup.com/calculators/time/decimal-to-time-calculator.php</a></p>
  
  <p>Which converting 0.3408565 <em>days</em> corresponds to the time of 8:10:50 by doing the following:</p>
  
  <pre><code>0.3408565 * 24 hours/day = 8.180555544 = 8 hours
  
  0.180555544 * 60 minutes = 10.83333264 = 10 minutes
  
  0.83333264 * 60 seconds = 49.9999584 = 50 seconds
  </code></pre>
  
  <p>As you can see it is extracting the remainder and doing further multiplication, however I'm not sure how I could implement the process within R. I want to convert all the values in my column using this so I can replace 0.3408565, 0.3864468, 0.4400231 etc with their actual time counterparts 8:10:50, 09:16:29, 10:33:38 respectively. This seems to be how it is done in Excel too.</p>
  
  <p>I tried writing my own function which in English does: </p>
  
  <pre><code>convertTime &lt;- function(x)
  {
  x * 60 = Hour
  x2 * 24 = Min
  x3 * 24 = Sec
  
  hourChar &lt;- as.character(Hour)
  minChar &lt;- as.character(Min)
  secChar &lt;- as.character(Sec)
  paste(hourChar, minChar, secChar, sep=":")
  }
  </code></pre>
  
  <p>With x being 0.3408565, but of course this doesn't extract the remainder. I might be seriously overcomplicating it, but I want to loop through all values in the column using each value as input to convert. </p>
  
  <p>Lastly, I have looked at packages such as 'lubridate' but cannot find anything that is relevant to my problem. </p>
  
  <p>I also browsed here for my specific situation but couldn't find anything really relevant to my problem. Is there any package or solution that could help me? </p>
  
  <p><strong>EDIT:</strong> I want to say both answers work perfectly for anyone else having this kind of problem, thank you to you both!</p>