search for: tranlist

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

Did you mean: tranlist2
2010 Jun 03
2
lapply or data.table to find a unit's previous transaction
...ot;), ncol= 1))) TranID<- do.call("rbind", TranID) UnitID<- substr(TranID, 1, nchar(n)) TranDt<- substr(TranID, nchar(n)+2, nchar(n)+11) Data<- data.frame(TranID= TranID, UnitID= UnitID, TranDt= as.Date(TranDt)) #First I create a list of all the previous transactions by unit TranList<- as.matrix(Data$TranID, ncol= 1) PreTran<- lapply(TranList, ??function(x) (with(Data, ??Data[ ??UnitID== substr(x, 1, nchar(n))& ??TranDt< Data[TranID== x, "TranDt"], ] ??)) ??) #I do get warnings about missing data because some transactions have no predecessor. #Some trans...