Quantcast
Viewing all articles
Browse latest Browse all 206342

Different time_lengths for interval, duration and period

I am new to lubridate. I tried to calculate the difference between two sets of time with lubridate but get slight different answers for interval, duration, and period

library(lubridate)
a <- dmy_hms("9/7/1988 4:30:00")
b <- dmy_hms("2/11/2019 4:30:00")

c <- a %--% b

per <- as.period(c)
dur <- as.duration(c)

time_length(c, unit = "year") #31.31694
time_length(per, unit = "year") #31.33716
time_length(dur, unit = "year") #31.33699

Viewing all articles
Browse latest Browse all 206342

Trending Articles



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