I am completely new to R, but running out of time here. In my dataset, I have people from several countries answering who they voted for last. People from different countries got different questions, so in each column, only the ones from the country have an answer, the rest is NA. I am trying to collect everyone who voted for a green party in one variable. So far I have succeeded in coding it into a separate dummy variable for each country using ifelse, but I cant seem to merge these variables. So now I have ie a variable for Germany, where a green vote in the german election is 1, and everyone else is 0. Same goes for France etc. But how can I collect all this information in just one variable?
Appreciate your help.
Aucun commentaire:
Enregistrer un commentaire