I'm searching in some sentences some words using this code
sent <- c()
for (w in my_words){
my_selected_sentences <- grep(paste0('\\b', w, '\\b'), my_sentences, ignore.case = TRUE, value = TRUE, perl = TRUE)
sent <- c(sent, my_selected_sentences)
}
Now I'd like to add in the vector "sent" word or words that have been retrieved. For example
[1] here is the selected sentence.---"the", "sentence"
How I can do? thanks!