Hi,
Sorry,`indx` should be:
indx<-which(tt$response=="buy") #I changed indx but forgot about it
tt$newcolumn<-0
tt[unlist(lapply(seq_along(indx),function(i) {x1<-if(indx[i]==nrow(tt))
indx[i] else seq(indx[i]+1,indx[i+1]-1);x2<-rbind(tt[indx[1:i],],tt[x1,]);
if(any(x2$response=="sample"))
row
Hi,
You may try this (didn't get time to test this extensively)
indx<-which(tt$response!="buy")
tt$newcolumn<-0
tt[unlist(lapply(seq_along(indx),function(i) {x1<-if(indx[i]==nrow(tt))
indx[i] else seq(indx[i]+1,indx[i+1]-1);x2<-rbind(tt[indx[1:i],],tt[x1,]);
if(any(x2$response=="sample"))
row.n
2 matches
Mail list logo