数据框排序 data.frame order
# sorting examples using the mtcars dataset attach(mtcars) # sort by mpg newdata <- mtcars[order(mpg),] # sort by mpg and cyl newdata <- mtcars[order(mpg, cyl),] #sort by mpg (ascending) and cyl (descending) newdata <- mtcars[order(mpg, -cyl),] detach(mtcars)
posted on 2016-03-23 14:38 MartinChau 阅读(211) 评论(0) 编辑 收藏 举报