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
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)
> -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 -
3 matches
Mail list logo