[R] How to sort data.frame
Paul Hiemstra
p.hiemstra at geo.uu.nl
Wed Jan 27 11:41:39 CET 2010
Hi,
Look at the sort_df function from the reshape package.
cheers,
Paul
Madhavi Bhave wrote:
> Dear R heleprs
>
> Suppose I have following data
>
>
>
>
>
>
>
>
>
> Scenarios
> combination_names
> series1
> series2
>
> Sc1
> MAT2 GAU1
> 7.26554
> 8.409778
>
> Sc2
> MAT2 GAU2
> 7.438128
> 8.130275
>
> Sc3
> MAT3 GAU1
> 8.058422
> 8.06457
>
> Sc4
> MAT1 GAU2
> 8.179855
> 8.022071
>
> Sc5
> MAT3 GAU2
> 8.184033
> 8.191831
>
> Sc6
> MAT3 GAU2
> 7.50312
> 8.232425
>
> Sc7
> MAT1 GAU2
> 7.603291
> 8.200993
>
> Sc8
> MAT1 GAU1
> 8.221755
> 8.380097
>
> Sc9
> MAT3 GAU2
> 7.904908
> 8.088824
>
> Sc10
> MAT1 GAU3
> 7.67034
> 8.46376
>
>
> I wish to sort thise data frame based on combination_names. Actually this is just an indicative data. I am deling with the data haveing 5000+ records.
>
> I just need to find out how to sort this data s.t, I will get say following result
>
>
>
>
>
> Scenarios
> combination_names
> series1
> series2
>
>
>
>
> Sc8
> MAT1 GAU1
> 8.221755
> 8.380097
>
>
>
>
> Sc4
> MAT1 GAU2
> 8.179855
> 8.022071
>
>
>
>
>
>
>
>
> Sc7
> MAT1 GAU2
> 7.603291
> 8.200993
> Sc10 MAT1 GAU3 7.67034 8.46376
>
>
>
>
> ........ and so
>
> I tried to understand the examples given in
> ?base::order but couldn't cracke it.
>
> Please guide
>
> Madhavi
>
>
>
> The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> [[alternative HTML version deleted]]
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
More information about the R-help
mailing list