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

Unexpected behaviour of `between` with dates #1639

Closed
conjugateprior opened this Issue Jan 24, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@conjugateprior
Copy link

conjugateprior commented Jan 24, 2016

Make some date indexable data

library(dplyr)
ds <- seq(as.Date("2016-01-01"), as.Date("2016-02-01"), by='day')
dd <- data_frame(date=ds, x=1:32)

This filter works

dd %>% filter(date >= "2016-01-04" & date <= "2016-01-06")

and this one with between works too

dd %>% filter(between(date, as.Date("2016-01-04"), as.Date("2016-01-06")))

but this one does not

dd %>% filter(between(date, "2016-01-04", "2016-01-06"))

Error: not compatible with requested type

Not sure if that's a bug or not, but it was a bit surprising and might be worth flagging.

@romainfrancois romainfrancois self-assigned this Jan 25, 2016

@romainfrancois

This comment has been minimized.

Copy link
Member

romainfrancois commented Jan 25, 2016

between is only supposed to work on numeric :

LogicalVector between(NumericVector x, double left, double right) ;
@conjugateprior

This comment has been minimized.

Copy link
Author

conjugateprior commented Jan 25, 2016

So the surprising thing is that it works in any date form. That's fair enough.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.