I have a dataframe like this one
familyid Year memberid count var
1 2000 1 2 5
1 2000 1 2 6
1 2000 2 1 8
2 2000 1 1 5
2 2000 2 1 4
3 2000 1 1 5
3 2000 2 2 7
3 2000 2 2 5
where the column count indicates how many times each observation compares in the dataframe. I want to transpose the dataframe only for those comparing more than one times, in other words I want to have
familyid Year memberid count var_1 var_2
1 2000 1 2 5 6
1 2000 2 1 8 NA
2 2000 1 1 5 NA
2 2000 2 1 4 NA
3 2000 1 1 5 NA
3 2000 2 2 7 5
What do you suggest to use for this purpose? Thank you so much.