I'm trying to understand how the
> a <- c(45,50,10,96)
 3 1 2 4
c(2, 3, 1, 4)
This seems to explain it.
The definition of
a[order(a)]is in increasing order. This works with your example, where the correct order is the fourth, second, first, then third element.
You may have been looking for
rank, which returns the rank of the elements
R> a <- c(4.1, 3.2, 6.1, 3.1)
 4 2 1 3
 3 2 4 1
ranktells you what order the numbers are in,
ordertells you how to get them in ascending order.
plot(a, rank(a)/length(a))will give a graph of the CDF. To see why
orderis useful, though, try
plot(a, rank(a)/length(a),type="S")which gives a mess, because the data are not in increasing order
If you did
you get a line graph of the CDF.
I'll bet you're thinking of rank.