WARNING: I am a R NEWBIE!!
I have an item on my survey that respondents could, “choose all that apply”.
Here’s the setup:
Q38. Do have a degree in a science field? 0=No, 1=Yes
Q39. Which of the following best describes your science major? If you had multiple majors, please indicate those. There are 8 choices:
- Astronomy
- Atmospheric Sciences
- Biology
- Chemistry
- Geology
- Ocean sciences
- Physical geography
- Physics
This created a string of numbers in some cases. I would like to create a new variable that I will call Degree that will have three values:
0. No science degree (picks up the 0 in Q38)
- Non-Earth Science degree (combines 3. Biology, 4. Chemistry, and 8. Physics)
- Earth Science degree (combines 1. Astronomy, 2. Atmospheric Sciences, 5. Geology, 6. Ocean Sciences, and 7. Physical Geography)
Does anyone have any tricks up your sleeve in accomplishing such a feat?