<div dir="ltr">In this case? Then nothing'll be different. <div><br></div><div>I'm not sure what you mean because the problem here is that this *doesn't* require *by-without-by* as the j-operations are not necessary to be performed *during* the join. So, we can just perform the join and then take the "abs" once at the end, rather than calling it about 1e5+ times (the number of groups).<div>
<br></div><div>So, if your question is: "apart from this question, how would an explicit by-without-by look like?", then I guess it'd be the same as the normal aggregation, but "by" would take a data.table as well. This has not yet been discussed or conceptualised. But this is how I imagine it to be:</div>
<div><br></div><div>DT1[, list(...), by=DT2]</div><div><br></div><div>Where, DT1's key columns have to be set as usual. </div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 6, 2014 at 12:55 PM, Gabor Grothendieck <span dir="ltr"><<a href="mailto:ggrothendieck@gmail.com" target="_blank">ggrothendieck@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Wed, Feb 5, 2014 at 10:42 AM, Arunkumar Srinivasan<br>
<<a href="mailto:aragorn168b@gmail.com">aragorn168b@gmail.com</a>> wrote:<br>
> Seems like the "by-without-by" is what's slowing things down:<br>
><br>
> require(data.table)<br>
> dtx <- data.table(x=which(X), key="x")<br>
> dty <- data.table(y=which(Y), key="y")<br>
> dtx[, x1 := x]<br>
> dty[, y1 := y]<br>
> system.time(ans <- dty[dtx, roll="nearest"][, abs(x1-y1)])<br>
> user system elapsed<br>
> 1.321 0.076 1.396<br>
> system.time(ans2 <- flodel(x,y))<br>
> user system elapsed<br>
> 0.936 0.044 0.977<br>
><br>
> identical(ans, ans2) # [1] TRUE<br>
<br>
</div>What will the code look like after the explicit by-without-by feature is added?<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Statistics & Software Consulting<br>
GKX Group, GKX Associates Inc.<br>
tel: 1-877-GKX-GROUP<br>
email: ggrothendieck at <a href="http://gmail.com" target="_blank">gmail.com</a><br>
</div></div></blockquote></div><br></div>