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

Question regarding inrange #1884

Closed
DavidArenburg opened this issue Oct 19, 2016 · 2 comments
Closed

Question regarding inrange #1884

DavidArenburg opened this issue Oct 19, 2016 · 2 comments

Comments

@DavidArenburg
Copy link
Member

@DavidArenburg DavidArenburg commented Oct 19, 2016

Consider this example

dt <- data.table(Test = c(200, 205), Min = c(100, 120), Max = c(200, 205))
dt[,Test %inrange% c(Min, Max)]
## [1] FALSE FALSE

Why am I getting FALSE for both? If I do just

200 %inrange% c(120, 205)
## [1] TRUE

I'm getting the desired output. Isn't inrange suppose to, and I quote ?inrange:

inrange checks whether each value in x is in between any of the intervals provided in lower,upper.

@franknarf1
Copy link
Contributor

@franknarf1 franknarf1 commented Oct 19, 2016

Maybe you need a list? dt[,Test %inrange% .(Min, Max)] # TRUE TRUE

I'm guessing it's just taking the first two elements from your vector, so c(100, 120) as bounds.

@DavidArenburg
Copy link
Member Author

@DavidArenburg DavidArenburg commented Oct 19, 2016

Yeah you are right. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants