It looks like "order" function is not working properly with repeated values. For example, check the code below. As you can see, same elemets have a different order.
Is there any way to fix this?
special <- c(0.8612482, 0.1728704, 0.1728704, 0.6933106, 0.4718281, 0.4718281, 0.8275597,
0.3934772, 0.3934772, 0.6777266, 0.2526969, 0.0605038, 0.7352600, 0.7352600,
2.2376845, 0.8814698, 2.7420961, 2.7420961, 1.5314565, 1.4855230)
special[8]
order(special)[8]
special[9]
order(special)[9]