[R] Sorting problem

Berton Gunter gunter.berton at gene.com
Thu Apr 6 17:22:58 CEST 2006


Please read the Help files before posting! At the bottom of ?sort you will
find a link to "order" which is the answer to your question.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Kåre Edvardsen
> Sent: Thursday, April 06, 2006 8:01 AM
> To: R-help
> Subject: [R] Sorting problem
> 
> R-gurus...
> 
> I've got a 5 column dataframe where I'd like to plot each ID's "b"
> against "c" with "b" in ascending order (within the same ID). How do I
> sort "b" so that the other variables are altered equally?
> 
>    ID    a    b  c     d
>    101   1  240 26.7  21.85
>    101   2  335 21.8  21.85
>    101   3 1387 26.6  21.85
>    101   4  877 24.1  21.85
>    101   5  978 24.3  21.85
>    101   7 4962 28.3  21.85
>    101   8 1690 26.1  21.85
>    101   9 2038 24.4  21.85
>    102   1  240 53.4  51.65
>    102   2  533 50.4  51.65
>    102   3  802 53.3  51.65
>    102   4 1155 47.0  51.65
>    102   5  953 47.7  51.65
>    102   7 5353 47.8  51.65
>    .
>    .
>    .
>    115   9  840 34.9  42.01
> 
> All the best,
> Kare
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list