I have a dataframe in the format mentioned below:
                  String  Keyword                           
1 Apples bananas mangoes   mangoes                    
2 Apples bananas mangoes   bananas                    
3 Apples bananas mangoes   peach   
.....  
Its a dataframe (50000+ rows). I'm currently manually using the ifelse statement in batches.
data$Result<- ifelse(grepl("apples",data$String,ignore.case = TRUE)==TRUE,"apples",  
              ifelse(grepl("bananas",data$String,ignore.case = TRUE)==TRUE,"bananas",
               ifelse(grepl("mangoes",data$String,ignore.case = TRUE)==TRUE,"mangoes","unavailable")))
                String    Keyword Result
Apples bananas mangoes    mangoes mangoes  
Apples bananas mangoes    bananas bananas  
Apples bananas mangoes    peach   unavailable
Is there a way, where I could store String and Keyword in a list and then apply grepl on the entire list?
 
     
     
    