Skip to content
Back to formatted view

Raw Message

Message-ID: <8b356f880904181241p7479ff62he8728caec6f0a070@mail.gmail.com>
Date: 2009-04-18T19:41:10Z
From: Stavros Macrakis
Subject: (no subject)
In-Reply-To: <COL112-W711AC168284E4DABEEAC39CF780@phx.gbl>

> mylist <- c( 2,1,3,5,4 )        <<< make a vector of numbers
> sort(mylist)
[1] 1 2 3 4 5                           <<< in sorted order

> mylist <- c( "this", "is", "a", "test")
> sort(mylist)
[1] "a"    "is"   "test" "this"      <<< in sorted order
> order(mylist)
[1] 3 2 4 1                     <<< original positions, e.g. mylist[3] is "a"


On Sat, Apr 18, 2009 at 10:46 AM, Dan Cary <daniel_cary at hotmail.co.uk> wrote:
> ...all i want to know is how to arrange a set of numbers in size order without putting them in a table. just arranging them from for e.g. 2,1,3,5,4 into 1,2,3,4,5 - it must be simple but i cant find how to do it anywhere