I'm currently trying to add a column to a data frame in R where, if certain conditions are met, a flag is made in a third column. Take a look at my example dataset below.
Name | Inventory | BLT_Flag
Amy Bacon 1
Amy lettuce 1
Amy Tomato 1
John Bacon 0
John Tomato 0
Katie Bacon 1
Katie Lettuce 1
Katie Tomato 1
Basically, I'm trying to code for the BLT_Flag. In this example, both Amy and Katie get the BLT Flags because their inventory includes all the ingredients for a BLT, while John is missing "Lettuce." I'm having a hard time creating a loop to create this flag. Any suggestions are greatly appreciated!