mardi 19 février 2019

ifelse command across rows and columns at the same time

I have aggregated data (Meetings in Persons in Groups) and want to conduct ifelse commands. Each group consists of a different number of persons and meetings. Now always when all members of one group show for the same meeting the same values on v_165_dicho, on v_166_dicho, and on v_167_dicho, a new variable should be created with the expression "agree", else "disagree" should be indicated on the new variable. Many thanks in advance!

       GroupID PersonID MeetID v_165_dicho v_166_dicho v_167_dicho
1         1      171       1           0           0           0
2         1      185       1           0           0           0
3         1      171       2           0           0           0
4         1      185       2           0           0           0
5         1      185       3           1           0           1
6         2      113       1           1           0           1
7         2      135       1           1           0           0
8         2      113       2           0           0           0
9         2      135       2           0           0           0

Aucun commentaire:

Enregistrer un commentaire