Dear Sir,

Thanks a lot for your valuable input and guidance.

Regards

Katherine

--- On Mon, 15/4/13, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote:

From: Jeff Newmiller <jdnew...@dcn.davis.ca.us>
Subject: Re: [R] Sorting data.frame and again sorting within data.frame
To: "David Winsemius" <dwinsem...@comcast.net>, "Katherine Gobin" 
<katherine_go...@yahoo.com>
Cc: r-help@r-project.org
Date: Monday, 15 April, 2013, 5:33 PM

Yes, that would be because she converted to Date on the fly in her example, and 
so apparently did not need this reminder.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

David Winsemius <dwinsem...@comcast.net> wrote:

>
>On Apr 14, 2013, at 11:01 PM, Katherine Gobin wrote:
>
>> Dear R forum,
>> 
>> I have a data.frame as defied below - 
>> 
>> df = data.frame(names = c("C", "A", "A", "B", "C", "B", "A", "B",
>"C"), dates = c("4/15/2013", "4/13/2013", "4/15/2013", "4/13/2013",
>"4/13/2013", "4/15/2013", "4/14/2013", "4/14/2013","4/14/2013" ),values
>= c(10, 31, 31, 17, 11, 34, 102, 47, 29))
>> 
>>> df
>>   names     dates values
>> 1     C 4/15/2013     10
>> 2     A 4/13/2013     31
>> 3     A 4/15/2013     31
>> 4     B 4/13/2013     17
>> 5     C 4/13/2013     11
>> 6     B
>> 4/15/2013     34
>> 7     A 4/14/2013    102
>> 8     B 4/14/2013     47
>> 9     C 4/14/2013     29
>> 
>> I need to sort df first on "names" in increasing order and then
>further on "dates" in a decreasing order i.e. I need
>> 
>
>So far no one has pointed out that these are not really "Dates" in the
>R sense and will not sort correctly if any of the proposed methods are
>applied to sequences that extend beyond6 months, i.e, until October
>forward. You would be advised to convert to real Date-classed
>variables.
>
>?strptime
>?as.Date


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to