search for: datadt

Displaying 1 result from an estimated 1 matches for "datadt".

Did you mean: data_t
2010 Jun 03
2
lapply or data.table to find a unit's previous transaction
...have used a combination of data.table and for loops, but that seems cheesey and doesn't preform much better. library(data.table) #First I create a list of all the previous transactions by unit TranList2<- vector(nrow(Data), mode= "list") names(TranList2)<- levels(Data$TranID) DataDT<- data.table(Data) #Use a for loop and data.table to find the date of the previous transaction for (i in levels(Data$TranID)) { if (DataDT[UnitID== substr(i, 1, nchar(n))& ?? TranDt<= (DataDT[TranID== i, TranDt]), length(TranDt)]> 1) TranList2[[i]]<- cbind(TranID= i, DataDT[UnitID...