I've got a character vector which looks like

c("white","white","blue","green","red","blue","red")

and a specific order which is like

c("red","white","blue","green")

. I would like to sort the first vector according to the order of the second vector in order to obtain the following vector : c("red","red","white","white","blue","blue", "green"). What would be the best solution ?

r
Edit
Report