Here is a simple question about creating a new column conditional on a row duplicate in one column matching criterion in different column. Specifically, if the row is a duplicate in column "pairs", create new column "new" based on rows in column "y" being equal/unequal.
In the actual data frame I have even more conditions for other columns but my main issue is with making these conditions dependent on the rows being the same in the "pairs" column.
Many thanks!
pairs y new
1 1 1
1 0 1
2 1 0
2 1 0
3 3 1
3 1 1
Assuming values are always paired, i.e., there are only two row in each group: