[R] sort a data frame according to all the Columns
eriki at ccbr.umn.edu
Wed Jan 27 22:55:12 CET 2010
Erik Iverson wrote:
> I think you want ?order
On second read, I think you want to do this without having to specify
all 18 variables in an order call... something like this (with only 3
v1 <- sample(rep(1:10, each = 2))
v2 <- sample(1:20)
v3 <- sample(1:20)
tmp <- data.frame(v1, v2, v3)
The data.frame tmp is my sample data.frame, and notice how the last line
I posted sorts by all columns without referencing the number of columns.
Hope that helps!
>> Hi, I have a data frame read from a .csv file, with columns
>> V1,V2,V3...,V18, per say, and I want to sort this data frame according
>> to V1, and then V2, then V3..., and so on. Is there any fast way to
>> get around with this problem?
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help