[datatable-help] Update on auto-join

Arunkumar Srinivasan aragorn168b at gmail.com
Wed Nov 11 15:45:31 CET 2015


Joins vignettes aren't done yet 😔. It is planned for v1.9.8. Will work on it after wrapping up things I am working on now.

Arun
--
Sent from my iPhone

> On 09 Nov 2015, at 02:43, Stefano Grioni <sgrioni at chicagobooth.edu> wrote:
> 
> Hello,
> 
> As I was reading through the vignette on data handling and joins, it was not immediately evident to me how to do an update on auto-join using only data table.
> 
> I have managed to do what I need using by using SQL, but I don't find it particularly elegant and performance will probably be terrible on large datasets:
> 
> tmp <- sqldf("select a.Field1, a.Field2, a.Field3, b.Output from MyDataset a INNER JOIN MyDataset b on a.Field1 =b.Field1 and a.Field2 = b.Field2+1and a.Field3=b.Field3")
> tmp <- as.data.table(tmp)
> setkey(MyDataset, Field1, Field2, Field3)
> setkey(tmp, Field1, Field2, Field3)
> MyDataset[tmp,Field4 := i.Output, nomatch=0]
> 
> I tried to do the same using twice the same data frame but I can't see how to integrate the join condition on Field2 (see above).
> 
> Is there an elegant way to address this?
> 
> Many thanks
> 
> Stefano
> _______________________________________________
> 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/20151111/e1fc39d0/attachment.html>


More information about the datatable-help mailing list