[datatable-help] by after a merge is useless except for by=.EACHI?

Frank Erickson fperickson at wisc.edu
Wed Jun 24 01:41:39 CEST 2015


I wanted to do

X[ Y, newx := yvar[1], by=yvar2 ]

Does what I'm trying to do here somehow not make sense? This seems to work
fine:

X[ Y, newx := yvar[1], by=.EACHI ]

My full example is below.

Thanks,

Frank

DT <- data.table(Address=c('A','B','C','A','D','C','E'),
Transaction=c(1,1,2,3,3,4,4))
setkey(DT,Address)
t0DT <- DT[,.(t0=Transaction[1]),by=Address]
DT[t0DT,Entity:=t0[1],by=Transaction]

based on
http://stackoverflow.com/questions/31011741/creating-an-entity-id-using-data-table
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20150623/cac37ff6/attachment.html>


More information about the datatable-help mailing list