EDITED
I have a data.frame that I want to group by certain columns (just y below), select distinct rows within each group and then add a new col
y