>>>>> "SteT" == Stephen Tucker <[EMAIL PROTECTED]>
>>>>>     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> <http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf>,
    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 = as.data.frame(strsplit("8.29.97","\\."))[1,]

  [......etc..very....useful..advice............]

______________________________________________
[email protected] 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