I am trying to create a new column in my dataset. So far, I have imported a JSON file into R with a column full of different words ("purple", "red", "blue", etc.) each observation has some combination of these words. My goal is to create a new column with the header of the words apparent ("purple", "red", "blue", etc.). I want that column to have True or Falses depending on whether the observations exhibit that color. I tried to use the subset function as well as manually doing so but there are over 300 different observations, making that very inconvenient. I greatly appreciate any help!
For example:
Observations Color
1 Blue
2 Red, Blue
3 Blue, Green
4 Purple
5 Yellow, Orange
and now I want
Observations Color Red Yellow Orange Blue
1 Blue False False False True
2 Red, Blue True False False True
etc
This is my first question on this site so i apologize if there are any problems.