Skip to content

NA-handling in between() #2562

@bschneidr

Description

@bschneidr

In the documentation for the between function called when using ?between, the function is described as

a shortcut for x >= left & x <= right

However, between handles NAs in a substantially different way than the quoted base R code would.

For example, if we called

2 >= 1 & 2 <= NA

we would receive an NA.

However, if we call the following

between(2, 1, NA)

we receive FALSE as the return value.

I think that a return value of NA makes more sense than a return value of FALSE here, but, if FALSE is going to be returned, then it seems like this discrepancy with the base R code ought to be clearly documented in the help for the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions