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
answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Namens lll73
Verzonden: woensdag 29 oktober 2008 12:18
Aan: r-help@r-project.org
Onderwerp: [R] Incorrect order
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
--
View this message in context:
http://www.nabble.com/Incorrect-order-tp20224993p20224993.html
Sent from the R help mailing list archive at Nabble.c
What's wrong with that result?
you should look at the result as: first take the 3th element of a, then the
first one, than the second one and then the fourth.
if you do a[order(a)] then you get 15,20,30,40.
I suppose you expected:
rank(a)
[1] 2 3 1 4
Good luck
Bart
lll73 wrote:
>
>
> I am
4 matches
Mail list logo