Re: [R] sorting question

2011-01-11 Thread Albert-Jan Roskam
Got it, after rtmíng I realized I had to use xtfrm: ord <- order(c(idvars, -xtfrm("t"))) myData[ord, ]   It's downright ugly, as it confronts the user with some implementation detail (cf SAS or SPSS), but well, it works. Cheers!! Albert-Jan

Re: [R] sorting question

2009-07-01 Thread Gabor Grothendieck
This maps each string to one of the form yearQqtr at which point you can sort them. Modify the mapping as necessary. > library(gsubfn) > dd <- c("2002", "2003H1", "2003H2", "2004", "2005Q1", "2005Q2") > gsubfn("H.|Q.|$", list(H1 = "Q1", H2 = "Q2", Q2 = "Q2", Q3 = "Q3", Q4 = "Q4", > "Q1"), dd)

Re: [R] sorting question

2009-07-01 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Steve Jaffe > Sent: Wednesday, July 01, 2009 9:59 AM > To: r-help@r-project.org > Subject: [R] sorting question > > > I've asked about custom sorting before and it appears that -