I tried to sort the following data frame. But I get error like
sort(test,decreasing = TRUE)
Error in
[.data.frame
(x, order(x, na.last = na.last, decreasing = decreasing)) : undefined columns selected"
test <- data.frame(x = c(26, 21, 20), y = c(34, 29, 28))
sort(test$y,decreasing = TRUE)
[1] 34 29 28
But I need
x y
1 20 28
2 21 29
3 26 34