temp <- data.frame(x=c(1,2,3), y=c("ba", "ab", "cc"))
temp
x y
1 1 ba
2 2 ab
3 3 cc
and I want to order by ascending x and descending y, but it doesn't work even I convert y from factor to string.
tt <- temp[order(-as.character(y)), ]
Error in -as.character(y) : invalid argument to unary operator