[R] sorting question

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Wed Jul 1 19:18:42 CEST 2009


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Steve Jaffe
> Sent: Wednesday, July 01, 2009 9:59 AM
> To: r-help at r-project.org
> Subject: [R] sorting question
> 
> 
> I've asked about custom sorting before and it appears that -- in terms of a
> user-defined order -- it can only be done either by defining a custom class
> or using various tricks with "order"
> 
> Just wondering if anyone has a clever way to order "vintages" of the form
> 2002, 2003H1, 2003H2, 2004,  2005Q1, 2005Q2, etc
> some have H1 or H2, some have Q1,Q2,Q3,Q4, some are just plain years. They
> should be sorted in the obvious order. I can think of doing something with
> s'trsplit' and 'order' but anyone have anything better?
> 
Steve,

I don't have a solution to your sort problem, but let me ask: what is the "obvious order" is in this situation?

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 
> (I still wonder why sorting with a user-defined function isn't supported.  I
> guess I should follow the open source philosophy and contribute my own, but
> it seems that would involve implementing an explicit, iterative sort
> algorithm, whereas it would make more sense for it to be  integrated with
> the internal sort function, if that were possible)
> 
> Thanks
> --
> View this message in context: http://www.nabble.com/sorting-question-
> tp24293430p24293430.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list