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
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to