I want to sort a data.frame frame by multiple columns. For example, with the data.frame frame below I would like to sort by column z'z' (descending) then by column b'b' (ascending):
dd <- data.frame(b = factor(c("Hi", "Med", "Hi", "Low"), levels = c("Low", "Med", "Hi"), ordered = TRUE), x = c("A", "D", "A", "C"), y = c(8, 3, 9, 9), z = c(1, 1, 1, 2)) dd b x y z 1 Hi A 8 1 2 Med D 3 1 3 Hi A 9 1 4 Low C 9 2