[datatable-help] Roll + nomatch mixes result
Michele
carrieromichele at gmail.com
Mon May 5 04:43:39 CEST 2014
Hello,I think this was recently introduced because this example comes from a
part of my codes double and triple checked in the past several times (I mean
I should have noticed before, maybe..):
data<-data.table(code = c(rep("A",26L), rep("B",10L)), id =
c(rep(1L, 20L), rep(2L, 6L), rep(1L, 10L)), date =
structure(c(14602, 14638, 14665, 14698, 14726, 14754, 14788, 14817, 14846,
14882, 14939, 15005, 15029, 15064,
15091, 15125, 15153, 15328, 15393,
15393, 15393, 15393, 15431, 15461, 15569, 15569, 14613, 14762,
15110, 15110, 15686, 15686, 14602, 14638, 14665, 14698),
class = "Date"))filter <- data.table(code = c("A", "B"),
id = c(2L, 1L), limit1 = structure(c(15564, 15681),
class = "Date"), limit2 = structure(c(15574, 15691),
class = "Date"), index_R = c(26610L,
22662L))setkey(data)setkey(filter, code, id, limit1)> filter[data,
nomatch=0, roll=T] code id limit1 limit2 index_R1: A 2
2012-02-23 2012-08-22 266102: A 2 2012-02-23 2012-08-22 266103: A
2 2012-08-17 2012-12-17 226624: A 2 2012-08-17 2012-12-17 226625:
B 1 2011-05-16 2012-08-22 266106: B 1 2011-05-16 2012-08-22 266107:
B 1 2012-12-12 2012-12-17 226628: B 1 2012-12-12 2012-12-17 22662>
> # expected outpit - workaround using any column from X which is never NA
(before doing X[Y, roll=T])> filter[data, roll=T][!is.na(index_R)] code id
limit1 limit2 index_R1: A 2 2012-08-17 2012-08-22 266102: A 2
2012-08-17 2012-08-22 266103: B 1 2012-12-12 2012-12-17 226624: B
1 2012-12-12 2012-12-17 22662
btw I'm on 1.9.3, the commit right before the by without by was sadly
removed (sadly cause I would need at least a whole week to change all my
codes...)Can you guys reproduce this? Is it already fixed?Regards,Michele.
--
View this message in context: http://r.789695.n4.nabble.com/Roll-nomatch-mixes-result-tp4689968.html
Sent from the datatable-help mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140504/7994bc7a/attachment.html>
More information about the datatable-help
mailing list