tsibble
tsibble copied to clipboard
max does not return maximum yearmonth from passed arguments
Taking a max of two yearmonths, the smaller (earlier) is returned.
> max(yearmonth('2017-01-01'), yearmonth('2018-04-01'))
<yearmonth[1]>
[1] "2017 Jan"
However, taking a max of two date objects, the bigger (later) is correctly returned.
> max(as.Date('2017-01-01'), as.Date('2018-04-01'))
[1] "2018-04-01"
>
This is an inherited from the {vctrs} package, the relevant issue for this is here: https://github.com/r-lib/vctrs/issues/1372
Passed via …
library(tsibble)
max(yearmonth('2017-01-01'), yearmonth('2018-04-01'))
#> <yearmonth[1]>
#> [1] "2017 Jan"
Passed via ..1 (x)
max(c(yearmonth('2017-01-01'), yearmonth('2018-04-01')))
#> <yearmonth[1]>
#> [1] "2018 Apr"
Created on 2021-05-26 by the reprex package (v2.0.0)
I see. I suppose we can close this issue then, unless you want to use it as a soft pressure device for the upstream :D Thanks for the heads up!