I have a dataframe with list of sentences in one column. Now i have a list of words and another list of replacement words as follows.
DF
Date Sentences
9-Nov-16 nah, i got rid of them overyears ago i was only watching pbs by then anyway i have xfinity on demand+netflix on my 'puter
9-Nov-16 Omg Netflix is working on my Xfinity!
and so on
List of Words
words <- c("nah","'puter","Omg")
trans <- c("No","computer","Oh my God")
and so on.
Now i want to replace "Nah" with "No" , "'puter" with "computer", "Omg" with "Oh my God" and so on in the sentences present in the above dataframe. To achieve this i use the following code.
DF$Sentences<- str_replace_all( DF$Sentences, paste0("\\b",words,"\\b"), trans)
But this is not replacing the words in the sentence. Can someone tell me the correct way of doing this?