Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NA-handling in between() #2562

Closed
bschneidr opened this issue Mar 22, 2017 · 0 comments
Closed

NA-handling in between() #2562

bschneidr opened this issue Mar 22, 2017 · 0 comments
Labels

Comments

@bschneidr
Copy link
Contributor

@bschneidr bschneidr commented Mar 22, 2017

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.

@hadley hadley closed this in 3ba202e Mar 23, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants