Good morning guys,I'm searching a better code to replace my code because of my old computer......
I use my code to assign ID based on the date range,the code is ok for small sample.
However,my data has 7000000obs and my date range has 70000obs,my old computer cannot finish this job because of my poor code,how can I improve the code efficiency?or may be have some better package I can use?Thanks you guys.
test=portnodaterange ###date range data
testdata=data ###data
emptyc=rep(NA,nrow(testdata))
for(i in 1:nrow(test)){
for (j in 1:nrow(testdata)){
if(testdata$crsp_fundno[j]==test$crsp_fundno[i] & between(testdata$caldt[j],test$begdt[i],test$enddt[i])==TRUE){emptyc[j]=test$crsp_portno[i]}
###assign suitable numbers to emptyc**
}}