Skip to content

Methods to compare year* with dates #267

Open
@arnaud-feldmann

Description

@arnaud-feldmann
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions