Lets Take example
I have one data frame called wf which has many rows and only 2 column 1st column has two word which will be relaced by 2nd column one word
wf
word1              word2
dikesh faldu    dikeshfaldu
any thing       anything
xyz asv         xyzasv
....
like this there are many rows suppose n..I have this variable already so nothing to do with wf okay.
and i have one Corpus which has 2 document many text data
so i have to find word1 and replace with word2 from wf
how can i do this ?
let suppose
w <- read.csv("xyz.csv")
w <- as.vector(w)
corpus <- Corpus(vectorSource(w))
then i want to find word1 in corpus and replace with word2
let
w <- "hello, dikesh faldu i want to replace word1 with word2 in this text data how can i do this xyz asv . where word1 is occured in this document i want to replace with word2"
i can use this
for (i in 1:nrow(wf)){
w <- gsub(wf[i,1],wf[i,2],w)
}
but its not working for two words are there in the first column in wf
i want output like this
hello, dikeshfaldu i want to replace word1 with word2 in this text data how can i do this xyzasv . where word1 is occured in this document i want to replace with word2
 
    