I'm using R studio to find pattern in array containing phrases. I'm trying to select all the entry containing some words at any position but my code is not working. Can any body help me please
You did not precise what result you are expecting. I guess you want all element in Text except n which does not have any of toto, percentage or instance. For that in the regex you need to use an OR clause, i.e |
You can do that with str_subset in stringr for example.
Thank you for the participation but it is not solving my problem.
What I want to do is to find independently of the position of the word in the phrase. with the array below for example I want to have as result the entry [4] and [6]
Text <- c("instance", "percentage", "n", "instance tes percentage toto", "percentage gff instance"," percentage tet toto tet instance ")
We are solving your problem step by step with the information you give. Quick reminder on how to ask better question: FAQ: Tips for writing R-related questions to get efficient answer !
Thanks for your availability to adjust you question though.