I have a dataframe df that contains several columns.
The dataframe is already sorted by Contact ID C_ID. A C_ID can appear multiple times in the dataframe. I want to put an "X" in the column MainRecord the first time the C_ID appears so that the result would be as follows:
C_ID Name MainRecord
1 JM X
1 JM
1 JM
2 DM X
3 TY X
3 TY
I think my solution would need to reference the head function: df[,head(1)]