Every documentation I've read seems to indicate that durations can be negative in lubridate 1.7.4, including the examples provided with the R Documentation:
> duration(-1, "days")
> duration(day = -1)
This one bugfix back in 2009 says something similar with example output:
> new_duration(secs = -1, mins = -1, hours = -1)
[1] "-1 hours, -1 minutes and -1 seconds"
But when I run duration(-1, "days")
, R returns:
[1] "86400s (~1 days)"
What's the deal?
a - b
makes sense, negative values ofb
also necessarily make sense.lubridate
allows subtracting durations from times, so it makes sense to allow those durations to be negative and to support a negation operation.