There's a new class "yearmonth" from the tsibble package. Its underlying class is Date. year() works for it but leap_year() doesn't. This is due to recognize() is too strict using all(). Can we use any() instead? I'm happy to give a pull request too. Thanks.
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
x <- tsibble::yearmonth(Sys.Date())
x
#> [1] "2018 Aug"
class(x)
#> [1] "yearmonth" "Date"
leap_year(x)
#> Error in leap_year(x): unrecognized date format
year(x)
#> [1] 2018
Created on 2018-08-07 by the reprex
package (v0.2.0).
There's a new class "yearmonth" from the tsibble package. Its underlying class is Date.
year()works for it butleap_year()doesn't. This is due torecognize()is too strict usingall(). Can we useany()instead? I'm happy to give a pull request too. Thanks.Created on 2018-08-07 by the reprex
package (v0.2.0).