<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
Thanks, now runs. That is a bug in v1.9.2 which is fixed in
v1.9.3 (I ran it to check), from NEWS :<br>
<br>
o When joining to fewer columns than the key has, using one of
the later key columns<br>
explicitly in j repeated the first value. A problem
introduced by v1.9.2 and not<br>
caught by our 1,220 tests, or tests in 37 dependent packages.
Test added. Many<br>
thanks to Michele Carriero for reporting.<br>
DT = data.table(a=1:2, b=letters[1:6], key="a,b") #
keyed by a and b<br>
DT[.(1), list(b,...)] # correct result again (joining
just to a not b but using b)<br>
<br>
Matt<br>
<br>
<br>
On 25/03/14 13:51, Shir Levkowitz wrote:<br>
</div>
<blockquote
cite="mid:AB6CF493-0BC5-4C9F-B3C5-19CA23812DBF@dc-energy.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Sorry about that! dt.classEx should just be dt.hrEx… Full
corrected example below. Also you are correct 3.0.2 is the R
version, not 3.2.0.
<div>Shir</div>
<div><br>
</div>
<div>-----<br>
<div><br>
</div>
<div><br>
library(data.table)<br>
<br>
# dates<br>
dt.dateEx <- data.table(date =
as.character(seq(as.Date('2014-04-01'), as.Date('2014-04-15'),
by = 1)))<br>
setkey(dt.dateEx, date)<br>
<br>
# hours <br>
dt.hrEx <- copy(dt.dateEx)<br>
dt.hrEx <- dt.hrEx[, list(hour_beginning =0:23), by =
list(dt = date)] # rep x24 per date<br>
setkey(dt.hrEx, dt, hour_beginning)<br>
<br>
# as expected<br>
dt.hrEx[dt.dateEx][, list(dt, hour_beginning)]<br>
<br>
# not expected outcome<br>
dt.hrEx[dt.dateEx, list(hour_beginning)]<br>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Mar 25, 2014, at 9:45 AM, Matt Dowle <<a
moz-do-not-send="true"
href="mailto:mdowle@mdowle.plus.com">mdowle@mdowle.plus.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
Shir is using v1.9.2 though, although in R 3.2.0
apparently which might mean R 3.0.2 perhaps.<br>
Anyway regardless of versions, the example code
results in errors. Shir?<br>
<br>
> # dates<br>
> dt.dateEx <- data.table(date =
as.character(seq(as.Date('2014-04-01'),
as.Date('2014-04-15'), by = 1)))<br>
> setkey(dt.dateEx, date)<br>
> <br>
> # hours<br>
> dt.hrEx <- copy(dt.dateEx)<br>
> dt.hrEx <- dt.hrEx[, list(hour_beginning
=0:23), by = list(dt = date)] # rep x24 per date<br>
> setkey(dt.hrEx, dt, hour_beginning)<br>
> <br>
> # as expected<br>
> dt.classEx[dt.dateEx][, list(dt,
hour_beginning)]<br>
Error: object 'dt.classEx' not found<br>
> <br>
> # not expected outcome<br>
> dt.classEx[dt.dateEx, list(hour_beginning)]<br>
Error: object 'dt.classEx' not found<br>
> <br>
<br>
<br>
<br>
<br>
On 24/03/14 19:57, Eduard Antonyan wrote:<br>
</div>
<blockquote
cite="mid:CAHZcBOrxJ8PCGa3mVLPEcmZ8nhTSr5zApUCnxZ63dTpraNCtDw@mail.gmail.com"
type="cite">
<div dir="ltr">You're probably expecting the
by-without-by behavior - see this post: <a
moz-do-not-send="true"
href="http://r.789695.n4.nabble.com/by-EACHI-and-related-please-check-ok-td4686732.html">http://r.789695.n4.nabble.com/by-EACHI-and-related-please-check-ok-td4686732.html</a>
and follow the links within for more detail.</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Mon, Mar 24, 2014 at
2:37 PM, Shir Levkowitz <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:levkowitz@dc-energy.com"
target="_blank">levkowitz@dc-energy.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">It looks like the
latest version of data.table has changed the
behavior of list( ) inside of a join - is this
behavior as expected? Has anyone reported or
encountered this change? It seems like a bug
to me. I am using data.table v1.9.2 in R 3.2.0
.<br>
<br>
Thanks,<br>
Shir Levkowitz<br>
<br>
<br>
<br>
<br>
<br>
#-----------------------------------------------<br>
<br>
<br>
library(data.table)<br>
<br>
# dates<br>
dt.dateEx <- data.table(date =
as.character(seq(as.Date('2014-04-01'),
as.Date('2014-04-15'), by = 1)))<br>
setkey(dt.dateEx, date)<br>
<br>
# hours<br>
dt.hrEx <- copy(dt.dateEx)<br>
dt.hrEx <- dt.hrEx[, list(hour_beginning
=0:23), by = list(dt = date)] # rep x24 per
date<br>
setkey(dt.hrEx, dt, hour_beginning)<br>
<br>
# as expected<br>
dt.classEx[dt.dateEx][, list(dt,
hour_beginning)]<br>
<br>
# not expected outcome<br>
dt.classEx[dt.dateEx, list(hour_beginning)]<br>
<br>
_______________________________________________<br>
datatable-help mailing list<br>
<a moz-do-not-send="true"
href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a moz-do-not-send="true"
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help"
target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
datatable-help mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>