s ever done for us?
~~
To: R Mailing List
Sent: Tue, January 11, 2011 12:11:01 PM
Subject: [R] sorting question
Hi,
I have a data frame with variables a, b, c (character vars) and t (time var,
could be represented as POSIXct or character, depending on which is most
useful.
The
Hi,
I have a data frame with variables a, b, c (character vars) and t (time var,
could be represented as POSIXct or character, depending on which is most
useful.
The format is "-mm-dd hh:mm:ss CET"). Now, I want to sort the data frame in
ascending order by a, b, c and then in descending or
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 so
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, 2005Q
5 matches
Mail list logo