Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

r - Average timestamps excluding the day

$
0
0

I want to average two timestamps, but excluding the day. For example, I need the average of 9:00 AM of Monday and 10:00 AM of Tuesday to be just 9:30 AM.

Take the following code as example:

x$Hora.inicio[1]
[1] "2019-11-15 23:06:00 UTC"

class(x$Hora.inicio[1])
[1] "POSIXct""POSIXt" 

mean(c(x$Hora.inicio[1], x$Hora.inicio[2]))
[1] "2019-11-16 10:16:00 UTC"

This outcome is not satisfactory because . How do I average timestamps so that the result accounts only for the time but not the day?

PS: This, this and this question are similar to mine but don't address my specific question.


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>