Don't understand the use of order() on both numerics and characters

Solution 1:

Thanks to the upper comment, I got to read through the help page and saw how the example in it works. And just wanna do a explanation for this situation:

  outcome3 <- outcome2[order(outcome2[ ,colnum],outcome2[,2]), ]

In this line, outcome2[ ,colnum] is to output the death rate and order() will rank the data from min to max, while the rest of the rows in each column would also change position according to this new order. So for this case, there is no need to add hospital name which is the second column into order() as the argument.

However, in the ranking of data for death rate, there could be some data having the same value which means some hospitals possibly have the same death rate for a certain disease, therefore "hospital name" as the second argument of order() would rank the name from "a" to "z" within a concident death rate.

So the basic idea is that order() gives an order to data in one column(1st arg), and if there are coincident data occured, then order() will give an order to the second argument(another column) for that coincident data, and this will reposition the corrsponding data in other columns as well based on the order from argument 1.