Skip to content

%within% result changes if interval is flipped #1036

@billybarc

Description

@billybarc

Is the result of test 2 from the reprex below expected behavior of %within%? I understand from lubridate:::.within why it returns FALSE, but I could not find any explanation in ?%within% or ?int_standardize as to why one would consider it to be false.

library(lubridate)
int <- interval(as.Date("2021-01-01"), as.Date("2021-12-31"))
x <- as.Date("2021-06-15")
x %within% int #test 1
int2 <- int_flip(int)
x %within% int2 #test 2

Should one always use int_standardize() for the interval when doing such a comparison?

Cross posted from stackoverflow

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