Re: [R] Using split() several times in a row?

From: Martin Maechler <>
Date: Sat 31 Mar 2007 - 19:22:05 GMT

>>>>> "SteT" == Stephen Tucker <>
>>>>> on Fri, 30 Mar 2007 18:41:39 -0700 (PDT) writes:


    SteT> For dates, I usually store them as "POSIXct" classes
    SteT> in data frames, but according to Gabor Grothendieck
    SteT> and Thomas Petzoldt's R Help Desk article
    SteT> <>,
    SteT> I should probably be using "chron" date and times...

I don't think you should (and I doubt Gabor and Thomas would recommend this in every case):

POSIXct (and 'POSIXlt', 'POSIXt' & 'Date') are part of standard R, and whereas they may seem not as convenient in all cases as "chron" etc, I'd rather recommed to stick to them in such a case.

    SteT> Nonetheless, POSIXct casses are what I know so I can
    SteT> show you that to get the month out of your column
    SteT> (replace "8.29.97" with your variable), you can do the
    SteT> following:

    SteT> month = format(strptime("8.29.97",format="%m.%d.%y"),format="%m")

    SteT> Or,
    SteT> month ="8.29.97","\\."))[1,]

  [......etc..very....useful..advice............] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun Apr 01 05:26:52 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 31 Mar 2007 - 22:30:38 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.