I have seen examples of using gsub and sapply to remove words from a dataframe.
Is there a solution using map
from purrr
library
library(purrr)
ID<-c(1,2)
Text_W<-c("I love vegetables, and some fruits","Can we meet tomorrow for a movies, and other fun activities")
new_tab<-tibble(ID,Text_W)
remove_words<-c("love", "and")
I tried these with no success:
#gsub from base
map_chr(new_tab$Text_W,~paste(gsub(remove_words,"")))
library(stringr)
#
map(new_tab$Text_W,~paste(str_replace_all(remove_words,"")))
Any help will be appreciated.