tsibble icon indicating copy to clipboard operation
tsibble copied to clipboard

Methods to compare year* with dates

Open arnaud-feldmann opened this issue 4 years ago • 0 comments

yearmonth("2021 04")>date("2021/03/01")
#[1] TRUE
#Warning message:
#Incompatible methods (">.vctrs_vctr", ">.Date") for ">"
yearmonth("2021 04")>date("2021/04/01")
#[1] FALSE
#Warning message:
#Incompatible methods (">.vctrs_vctr", ">.Date") for ">"
yearmonth("2020 04")>date("2021/03/01")
#[1] FALSE
#Warning message:
#Incompatible methods (">.vctrs_vctr", ">.Date") for ">"
yearquarter("2021Q1")>date("2021/03/01")
 #[1] FALSE
#Warning message:
#Incompatible methods (">.vctrs_vctr", ">.Date") for ">" 
yearquarter("2021Q2")>date("2021/03/01")
#[1] TRUE
#Warning message:
#Incompatible methods (">.vctrs_vctr", ">.Date") for ">" 

It gives the right result but gives a warning.

It would be very fine for it to work without explicit conversions in order to be able to write generic functions that work on yearmonth, yearquarter.

arnaud-feldmann avatar Nov 02 '21 16:11 arnaud-feldmann