I have a set of words in a column and I want to check the presence/absence of an "o" or "u" in them. If the word has an "o" or "u" I want a new column with the "1" if it doesn't I want a "O".
Example of how the data looks now:
ID Word
1 rabbit 2 horse 3 tunnel 4 table
ID Word Subset_Vowel 1 rabbit 0
2 horse. 1 3 tunnel 1 4 table 0
I tried this code: DryRun_data_df$Subset_Vowel <- ifelse(str_detect(words, "o" || "u"), 1, 0)
But here was the error: Error in "o" || "u" : invalid 'x' type in 'x || y'
I am also open to other ways on how to check the absence/presence of "o" and "u"
Thanks for all your help in advance!!
Aucun commentaire:
Enregistrer un commentaire