My problem is similar to this question. But the solution didn't work for me.
I asked tourists what kind of traveler types they are. It was a multiple-choice question with 6 different categories (Nature, Culture, Health, Active, Family, Other) and they were able to choose more than one type. In Google Sheets and Excel, the answers within one column are separated by commas. So I ended up with a variable that looks kind of like this:
Traveller Type |
---|
Family, Nature |
Nature |
Culture, Nature |
Nature, Other |
Culture |
How do I separate the traveller types into new variables of my big table in RStudio? It should look like this:
Traveller Type | Family | Nature | Culture | Health | Active | Other |
---|---|---|---|---|---|---|
Family, Nature | 1 | 1 | 0 | 0 | 0 | 0 |
Nature | 0 | 1 | 0 | 0 | 0 | 0 |
Culture, Nature | 0 | 1 | 1 | 0 | 0 | 0 |
Nature, Other | 0 | 1 | 0 | 0 | 0 | 1 |
Culture, Active | 0 | 0 | 1 | 0 | 1 | 0 |
I've tried this, but the function "mutate_at" didn't work, and also I didn't really understand how to insert my data.