jak123  
                
               
                 
              
                  
                    December 7, 2021,  8:59am
                   
                   
              1 
               
             
            
              Hi Rcommunity
got another problem, have 2 df:
sample id: 
structure(list(ID = c(595119208, 595174634, 210018628, 355597680 
)), class = "data.frame", row.names = c(NA, -4L))
i want to see if the sample ID (from the first df exist in bogaa df, and if it does it should return a 1 in the "dboga$bogarule" else 0. and it should return the name of the main lead in "boga$meanlead" elso na.
thx!
             
            
               
               
               
            
           
          
            
              
                xvalda  
                
               
              
                  
                    December 7, 2021, 10:26am
                   
                   
              2 
               
             
            
              Hi @jak123  ,
Is it what you're looking for?
sample_id %>% mutate(
  bogarule = ifelse(ID %in% bogaa$ID, 1, 0), 
  meanLead = ifelse(ID %in% bogaa$ID, bogaa$meanLead, NA))
 
             
            
               
               
               
            
           
          
            
              
                jak123  
                
               
              
                  
                    December 7, 2021, 11:40am
                   
                   
              4 
               
             
            
              
 xvalda:
 
sample_id %>% mutate(
  bogarule = ifelse(ID %in% bogaa$ID, 1, 0), 
  meanLead = ifelse(ID %in% bogaa$ID, bogaa$meanLead, NA))
 
 
 
Fixed and thanks alot, i will return later 
             
            
               
               
               
            
           
          
            
              
                system  
                
                  Closed 
               
              
                  
                    December 14, 2021, 11:41am
                   
                   
              5 
               
             
            
              This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.  If you have a query related to it or one of the replies, start a new topic and refer back with a link.