SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --psuedo code--
  2. DF3<-subset(DF2, BSTN==DF1$BSTN & ASTN==DF1$ASTN & BSEC>DF1$BSEC & ASEC<DF1$ASEC)
  3.  
  4. if nrow(DF3)==1 then cbind(DF1,DF2)
  5.  
  6. --my code now--
  7. for(i in 1:nrow(DF1)){
  8.   DF1.1<-DF1[i,]
  9.   DF3<-subset(DF2, BSTN1==DF1.1$BSTN & ASTN1==DF1.1$ASTN & BSEC1>DF1.1$BSEC & ASEC1<DF1.1$ASEC)
  10.  
  11. if(nrow(DF3)==1)(aa<-bind_cols(DF1.1,DF3))
  12.   temp.res<-bind_rows(temp.res,aa)
  13.   }
  14.      
  15. ID  BSTN     ASTN   BSEC    ASEC
  16. 1   2520    2516    200079  21071
  17. 2   2520    2516    200079  51071  
  18. 3   228     2516    300079  31071
  19.      
  20. TRNID   BSTN     ASTN   BSEC    ASEC
  21. 1       2520    2516    200080  21061  
  22. 2       2520    2516    400079  41231  
  23. 3       2520    2516    500079  52171  
  24. 4       2520    2516    600079  60101
  25. 5       228     2516    300100  31061  
  26. 6       228     2516    400079  41231  
  27. 7       228     2516    500079  52171  
  28. 8       228     2516    600079  60101
  29.      
  30. ID  BSTN     ASTN   BSEC    ASEC    TRNID   BSTN     ASTN   BSEC    ASEC
  31. 1   2520    2516    200079  21071   1       2520    2516    200080  21061
  32. 3   228     2516    300079  31071   5       2520    2516    300100  31061
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top