| To: | s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | sorting a dataframe |
| From: | "Data Analytics Corp." <dataanalytics@earthlink.net> |
| Date: | Sun, 27 Jan 2008 20:12:44 -0500 |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=IVH6YFD0CMizEdT7xhnG03PBaeoxLGGsVksF/TKXaeZBxaYQ1pFO3uclyc+1GeSm; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; |
| User-agent: | Thunderbird 2.0.0.9 (Windows/20071031) |
Hi, I have a simple dataframe, x, of two columns: year month 2008 1 2007 4 2007 5 2007 6 2007 7 2007 8 2007 9 2007 10 2007 11 2007 12that I want to sort by year, then month. Forget the fact that I could just move the first row to the end of x to get what I want; this is just an example. I used
sort.col(x, "@ALL", 1:2, ascending = T)
and got
year month
2007 8
2007 9
2007 10
2007 11
2007 12
2007 4
2007 5
2007 6
2007 7
2008 1
when, of course, I should have gotten
year month
2007 4
2007 5
2007 6
2007 7
2007 8
2007 9
2007 10
2007 11
2007 12
2008 1
I also tried sort.col(x, 1:2, 1:2) and got the same result. Why? This
should be a simple sort. I put the data into Excel (sorry about that)
and got the correct sort. Why not here?
Thanks, Walt Paczkowski |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Names of coefficients in GLM, Bill.Venables |
|---|---|
| Next by Date: | Re: sorting a dataframe, El Imam Hanan Attia Rizk |
| Previous by Thread: | Names of coefficients in GLM, yiwu ye |
| Next by Thread: | Re: sorting a dataframe, El Imam Hanan Attia Rizk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |