##sorting
D <- data.frame(x =c(1, 2, 3, 4), y = c(4, 5, 6, 7))
D
##sorting
indexes <- order(D$x)
D[indexes,]
##reverse sorting
D[rev(order(D$y)),]
D <- data.frame(x =c(1, 2, 3, 4), y = c(4, 5, 6, 7))
D
##sorting
indexes <- order(D$x)
D[indexes,]
##reverse sorting
D[rev(order(D$y)),]
No comments:
Post a Comment