I'm trying to filter only rows from my table that have the word "dog" in the title column but I cannot get it to work.
Here's a data example:
ID NozamaItemID NozamaTitle
1 4557 12000017544 Starbucks Double Shot Espresso Light (4 Count, 6.5 Fl Oz Each)
2 4558 12000021992 Pepsi, 8Ct, 12Oz Bottle
3 4559 12000024542 Zuke'S Natural Hip Action dog Treats, 3 Oz
4 4560 12000030680 Pepsi Made With Real Sugar, 12 Ct, 12 Oz Cans
5 4561 12000030680 Pepsi Made With Real Sugar, 12 Ct, 12 Oz Cans
6 4562 12000030680 Pepsi Made With Real Sugar, 12 Ct, 12 Oz Cans
The following code should work but does not:
amzp <- select(amz, ID, NozamaItemID, NozamaTitle, NozamaCustomerID)
searchTerm="cat|dog"
amzp.a <- mutate(amzp, animalFood = ifelse(grepl(searchTerm, amzp$NozamaTitle, ignore.case = TRUE) == TRUE, TRUE, FALSE))
I would expect to see a TRUE for row 3. Any help is appreciated. Thanks