I want to rearrange a dataframe in a delicate way. By using as.data.frame(), I have tried many times but still can't get what I want. This is what I have read from the csv.
score1990 score1990 score1990 score1986 score1986 score1986
Country Year Both Female Male Both Female Male
Afghanistan 2013 61 62 61 16 17 15
Afghanistan 2012 60 61 58 16 17 15
Albania 2013 74 76 73 19 20 18
Albania 2012 74 75 73 19 20 18
Albania 2000 70 73 68 17 18 15
This is what I want to obtain
Country Year Sex score1990 score1986
Afghanistan 2013 Both 61 16
Afghanistan 2013 Female 62 17
Afghanistan 2013 Male 61 15
:
:
Albania 2012 Both 74 19
Albania 2012 Female 75 20