Skip to content

Selecting elements from a vector (a simple question with weird results)

7 messages · Philipp Pagel, Jorge Ivan Velez, Tal Galili +2 more

#
Looks like everything is working as expected to me. So maybe you should
explain what result you would like to get.

cu
	Philipp
#
Tal Galili <tal.galili at gmail.com> [Sat, Mar 28, 2009 at 06:48:36PM CET]:
To my mind, it does what you told it to, and therefore "works"
in my book. The routine orders the numbers by placing the third element
first, the first second, and the second third.

Maybe aa[order(aa)] does what you mean it to do?

Best wishes


Johannes
#
aa[order(aa)] is the same as sort, although sort is much quicker and
has lower memory requirements:
[1] TRUE
user  system elapsed
   7.27    0.08    8.25
user  system elapsed
  29.58    0.32   31.31

(yes, I have a pitifully slow computer)

HTH,

Andrew.
On Mar 29, 8:01?am, Tal Galili <tal.gal... at gmail.com> wrote: