[R] in excel i can sort my dataset, what do i use in R

baptiste auguie baptiste.auguie at googlemail.com
Mon Nov 16 20:13:49 CET 2009


?order
?sort


2009/11/16 frenchcr <frenchcr at btinternet.com>:
>
>
>
> In excel a handy tool is the sort data by column ...i.e. i can highlight the
> whole dataset and sort it according to a particular column...like sort the
> data in a column in acending or decending order where all the other columns
> change aswell.
>
> I need to do this in R now but dont know how.
>
> ...heres an example...
>
> Say I have dataset...
>
>      Header 1    Header 2    Header 3
> 1         3          Working     12
> 2         4          Off            1
> 3         5          Works        2
> 4         2          Works        13
> 5         4          Off            5
>
>
> ...and i want to sort the data by putting the values in the third column in
> acending order, like this...
>
>     Header 1    Header 2    Header 3
>
> 1         4          Off            1
> 2         5          Works        2
> 3         4          Off            5
> 4         3          Working     12
> 5         2          Works        13
>
> ...although im sorting column three in acending order all the rows shuffle
> so that the parameters in each row stay aligned.
>
>
>
> How do i do this in R?
> --
> View this message in context: http://old.nabble.com/in-excel-i-can-sort-my-dataset%2C-what-do-i-use-in-R-tp26377540p26377540.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list