[datatable-help] Self-Join: Potential Bug?

Arunkumar Srinivasan aragorn168b at gmail.com
Sat Jun 21 09:43:29 CEST 2014


Michael,
You should be using `CJ`. This is no different from the post from Garrett See http://lists.r-forge.r-project.org/pipermail/datatable-help/2014-June/002619.html just last week, IIUC.

Arun

From: Michael Smith my.r.help at gmail.com
Reply: Michael Smith my.r.help at gmail.com
Date: June 21, 2014 at 9:40:17 AM
To: datatable-help at lists.r-forge.r-project.org datatable-help at lists.r-forge.r-project.org
Subject:  [datatable-help] Self-Join: Potential Bug?  

I'm getting a warning when I run the following code in 1.9.2,  
dev-1.9.3-master, and dev-1.9.3-issue_700 (b/c I thought it looks  
similar to that issue, but it turns out it's different). In contrast, I  
do not get this warning in 1.8.10.  

Not sure whether this is a bug or whether I'm missing something:  

X <- data.table(  
structure(list(ID = c(45063L, 45066L, 45172L), date = structure(c(14548,  
14487, 14395), class = "Date"), price = c(17.56, 12.49, 10.04  
)), .Names = c("ID", "date", "price"), row.names = c(NA, -3L), class =  
"data.frame"),  
key = "ID,date")  
X[J(unique(ID), as.Date(c("2009-05-31", "2010-05-31")))]  


The data and the warning message look like this:  

> X  
ID date price  
1: 45063 2009-10-31 17.56  
2: 45066 2009-08-31 12.49  
3: 45172 2009-05-31 10.04  
> X[J(unique(ID), as.Date(c("2009-05-31", "2010-05-31")))]  
ID date price  
1: 45063 2009-05-31 NA  
2: 45066 2010-05-31 NA  
3: 45172 2009-05-31 10.04  
Warning message:  
In as.data.table.list(i) :  
Item 2 is of size 2 but maximum size is 3 (recycled leaving a  
remainder of 1 items)  


Thanks,  
M  
_______________________________________________  
datatable-help mailing list  
datatable-help at lists.r-forge.r-project.org  
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140621/d9cb6ca7/attachment.html>


More information about the datatable-help mailing list