Suppose a data.frame with numeric values and strings:
set.seed(1)
dados <- data.frame(w=rep(c("A", "B"), 2), x= rep(c("D", "C"), 2), y= rnorm(4), z=rnorm(4),
stringsAsFactors=FALSE)
dados
w x y z
1 A D -0.6264538 0.3295078
2 B C 0.1836433 -0.8204684
3 A D -0.8356286 0.4874291
4 B C 1.5952808 0.7383247
How do I sort the date.frame by a column? And how do I sort with more than one column, and each with different orders (some in ascending order, others in descending order)?