I have a data frame, class, with 3 columns (user, lab_id, score). Some lines have the same user, and the same lab_id, and some are unique rows. I want to sort the rows to go in order of user, then lab_id and the score, where score would be going in decreasing order.
So I type:
sort.class<-class[order("class$user","class$lab_id","-class$totalScore"),]
But this just gives me a data frame with only 1 row, which I know is impossible.
order("mtcars$mpg", "mtcars$cyl", "-mtcars$disp")? Yup. 1. So if you tried to sort by that, you would be essentially doing the equivalent ofmtcars[1, ], which would return a single row.