A dataset I am using recorded respondents' ethnicity. Responses are recorded across multiple variables, and respondents were allowed to pick more than one. Example:
Black White Asian Hispanic
1 NA NA NA
NA 1 NA NA
NA NA NA 1
NA NA 1 1
^^^In the last row, the respondent would have chosen Asian and Hispanic.
What I want to do is:
A) collapse these columns into a single ethnicity variable, with different numbers representing different ethnicities (i.e., black would be 1, white would be 2 etc.)
B) have it so that anyone who reported multiple columns gets designated "multiple".
I'm a bit of an R novice, so any help would be greatly appreciated!