R and Lubridate: Calculating Time Differences in R using intervals aka a better way to compute daynumber starting from arbitrary day of the week
Pontifications
- the following is from my new repo about r and r studio tips and tricks
interval(ymd_hms("2019-01-04 18:40:00",
tz = "America/Vancouver"),
ymd_hms("2019-01-07 12:59:00",
tz = "America/Vancouver")) / hours(1)
[1] 66.31667
- The above ^^^^ is the most accurate and the best way to compute daynumber starting at an arbitrary day of the week e.g. Tuesday for Firefox releases!
You can also use lubridate
durations
, but durations aren’t accurate when you transition from month to month or year to year