unique() for periods always returns zero.
I'd expect it to either work or throw an error if not implemented.
Workaround exists as below. Hope useful. Many thanks.
test = c(rep(lubridate::as.period("2 day"),3), rep(lubridate::as.period("1 day"),3))
# Undesirable behaviour:
if (unique(test)==0) warning("This is unexpected")
# Workaround
lubridate::as.period(unique(as.character(test)))
unique() for periods always returns zero. I'd expect it to either work or throw an error if not implemented. Workaround exists as below. Hope useful. Many thanks.