If I have a dataframe was values such as:
df<- c("One", "Two Three", "Four", "Five")
df<-data.frame(df)
df
"One"
"Two Three"
"Four"
"Five"
And I have another dataframe such as:
df2<-c("the park was number one", "I think the park was number two three", "Nah one and two is ok", "tell me about four and five")
df2<-data.frame(df2)
df2
the park was number one
I think the park was number two three
Nah one and two is ok
tell me about four and five
If one of the values found in df are found in any of the strings of df2[,1], how do I replace it with a word like "it".
I want to replace my final df2 with this:
df3
the park was number it
I think the park was number it
Nah it and two is ok
tell me about it and it
I know it probably has to do with something like:
gsub(df,"it", df2)
But I don't think that is right.
Thanks!