Hi,
This is an example dataframe
Col 1 Col 2 Col 3 Col 4 Col 5
Apple Dog 1 2 5
Banana Elephant 3 4 6
Cat Apple 7 8 9
Dog Cat 10 11 12
Elephant Banana 13 14 15
Values given in column 3,4 and 5 represent values associated with names given in column 2. I find to sort my data frame such that the values in columns 2, 3, 4 and 5 correspond to names in column 1. This would mean
Col 1 Col 2 Col 3 Col 4 Col 5
Apple Apple 7 8 9
Banana Banana 13 14 15
Cat Cat 10 11 12
Dog Dog 1 2 5
Elephant Elephant 3 4 6
Can someone please help with an R code that would help me accomplish this? Many thanks