| To: | "Leeds, Mark" <mleeds@mlp.com> |
|---|---|
| Subject: | Re: sorting one column and having the other 2 move also |
| From: | Spencer Graves <spencer.graves@pdf.com> |
| Date: | Sat, 17 Jul 2004 03:08:50 -0700 |
| Cc: | s-news@lists.biostat.wustl.edu |
| In-reply-to: | <54668D97C0199943A454516A5FF6481E58A0D9@EXCHUS001.AD.MLP.COM> |
| References: | <54668D97C0199943A454516A5FF6481E58A0D9@EXCHUS001.AD.MLP.COM> |
| User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
?order DF <- data.frame(a=letters[c(3, 1, 2, 4)], b=1:4) o <- order(DF$a) DF[o,] > DF[o,] a b 2 a 2 3 b 3 1 c 1 4 d 4 > o [1] 2 3 1 4 > Leeds, Mark wrote: i have a dataframe with 3 columns"name", "ticker" and "shares" whichare character, chracter and integer respectively.i want to sort the dataframe bythe first column : "name" and have the other 2 columns move along with the sorted first column as you would expect.i suspect it's not possible to do this soi will have to sort the first column by itself and then use some kind of indexing thing in a loop of some sort but i am checking first before i start dealing with this.thanks. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Character Coercion of time sequences! (summary), Dimitrios Chalvatzis |
|---|---|
| Next by Date: | Problem with dynmaic memory allocation, Glenn . Treacy |
| Previous by Thread: | sorting one column and having the other 2 move also, Leeds, Mark |
| Next by Thread: | Re: sorting one column and having the other 2 move also, David L Lorenz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |