Speed Up Check if words exist in data frame

I would like to check if praise is in my data frame.

praise <- c("great", "good", "nice", "cool", "love", "excellent", "well")
praise <- c(praise, synonyms(praise, return.list=FALSE, multiwords=FALSE))

Data Frame:

others_data <- data.frame(text=c("Lately, I haven't been able to view my Online Payment Card. It's prompting me to have to upgrade my account whereas before it didn't. I have used the Card at various online stores before and have successfully used it. But now it's starting to get very frustrating that I have to said \"upgrade\" my account. Do fix this... **I noticed some users have the same issue..","I've been using this app for almost 2 years without any problems. Until, their system just blocked my virtual paying card without any notice. So, I was forced to apply for an upgrade and it was rejected thrice, despite providing all of my available IDs. This app has been a big disappointment."), id=c(1,2), stringsAsFactors = FALSE)

Below is my source code to check. For-loop is too slow.

for (row_num in 1:nrow(others_data)) {
      for (i in 1:length(praise)) {
        if (grepl(praise[i], others_data$text[row_num], ignore.case=TRUE)) {
          others_data$intention[row_num] <- "PRAISE"
        }
      }
}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.