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

1.9.7 rolling join not working correctly #1904

Closed
rrichmond opened this issue Nov 7, 2016 · 0 comments
Closed

1.9.7 rolling join not working correctly #1904

rrichmond opened this issue Nov 7, 2016 · 0 comments
Milestone

Comments

@rrichmond
Copy link

rrichmond commented Nov 7, 2016

I just updated to the latest revision of 1.9.7 and it looks like rolling joins aren't working correctly. Here's an example on 1.9.7:

library(data.table)
library(zoo)
library(lubridate)

mydates <- data.table(yearmon=as.yearmon(2000+2/12+seq(0,1,by=3/12)))

othervals <- data.table(date=mdy("12301999")+months(seq(0,24,by=6)))
othervals[,yearmon:=as.yearmon(date)]

setkey(othervals,yearmon)
setkey(mydates,yearmon)

othervals[mydates,roll=TRUE]
othervals[mydates,roll=1/12]

> othervals[mydates,roll=TRUE]
         date  yearmon
1: 1999-12-30 Mar 2000
2: 2000-06-30 Jun 2000
3: 2000-06-30 Sep 2000
4: 2000-12-30 Dec 2000
5: 2000-12-30 Mar 2001
> othervals[mydates,roll=1/12]
         date  yearmon
1:       <NA> Mar 2000
2: 2000-06-30 Jun 2000
3: 2000-06-30 Sep 2000
4: 2000-12-30 Dec 2000
5:       <NA> Mar 2001

Whereas on 1.9.6 the correct output is:

> othervals[mydates,roll=TRUE]
         date  yearmon
1: 1999-12-30 Mar 2000
2: 2000-06-30 Jun 2000
3: 2000-06-30 Sep 2000
4: 2000-12-30 Dec 2000
5: 2000-12-30 Mar 2001
> othervals[mydates,roll=1/12]
         date  yearmon
1:       <NA> Mar 2000
2: 2000-06-30 Jun 2000
3:       <NA> Sep 2000
4: 2000-12-30 Dec 2000
5:       <NA> Mar 2001
> 

On 1.9.6 the index difference is being correctly calculated whereas on 1.9.7 it is not.

@mattdowle mattdowle added this to the v1.9.8 milestone Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants