I have a simple question, but I can't find the correct code to do it. I tried grepl, but that didn't work. I want to create a value (string) for a new variable based on another variable containing a specific word.
If Var1 contains "apples" then var2="fruit"
Var1 Var 2
green apples Fruit