I have a dataframe with one column reporting components of a meal, for example:
----------------------------------
| ID | Component |
----------------------------------
| 1 | Vegetables |
| 2 | Pasta |
| 3 | Pasta, Vegetables |
| 4 | Pulses, Vegetables |
| 5 | Meat, Pasta, Vegetables|
| 6 | Meat, Vegetables |
| 7 | Pulses |
| 8 | Meat |
----------------------------------
I am looking to add an additional column, giving each person a score. I want them to receive a 1 if their meal contained Pasta, and 0 if it didn't. So participants 2, 3 and 5 get a 1, whilst the others get a 0.
Is there code which allows me to apply this to just the term 'pasta' ?
Any help would be appreciated! thanks.