Hi,

I believe Bart answered to your question. What is the solution you are 
expecting? If you don't give us more explanations we cannot understand 
what is wrong for you.

 > help(sort)
|order| returns a permutation which rearranges its first argument into 
ascending or descending order, breaking ties by further arguments. 
|sort.list| is the same, using only one argument.
See the examples for how to use these functions to sort data frames, etc.

In the section "see also" of the help about sort there are the two 
functions sort and rank!

 > a<-c(20,30,15,40)
 > sort(a)
[1] 15 20 30 40
 > order(a)
[1] 3 1 2 4
 > rank(a)
[1] 2 3 1 4


Alain




lll73 wrote:
> I am using the order function and the result seems to be incorrect:
>
>   
>> a<-c(20,30,15,40)
>> order(a)
>>     
> [1] 3 1 2 4
>
> Any suggestions?
>
> Thanks,
> Laura
>
>   

-- 
Alain Guillet
Statistician and Computer Scientist

Institut de statistique - Université catholique de Louvain
Bureau d.126
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium

tel: +32 10 47 30 50


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to