[R] sorting dataframe

Rina Oldager Miehs rinamiehs at gmail.com
Wed Nov 21 10:56:33 CET 2007


Hello

We have a problem with sorting our dataframe...
i have tried to write

x <- males[sort(males$index, decreasing=T),]

But that just gives me

> x
      id sex BVgain BVmeat phenogain phenomeat index
NA    NA  NA     NA     NA        NA        NA    NA
NA.1  NA  NA     NA     NA        NA        NA    NA
NA.2  NA  NA     NA     NA        NA        NA    NA
NA.3  NA  NA     NA     NA        NA        NA    NA
NA.4  NA  NA     NA     NA        NA        NA    NA

And that is not right...

We have 7 variables in a dataframe and we need it sorted by one
variable... how do we do that so we get the same dataframe out just
sorted....???
Please help:)

Cincerely Rina Miehs



More information about the R-help mailing list