In R, type the expression that sorts orders by province A to Z and, within each province, by amount from highest to lowest.
In R, type the expression that sorts orders by province A to Z and, within each province, by amount from highest to lowest.
Answer
orders[order(ordersprov, -ordersamount), ]
order() returns the row positions; the minus sign makes the second key descending. AB 1320, AB 980, BC 640 … The trailing comma keeps all columns.