[R] Dates in R

Horace Tso Horace.Tso at pgn.com
Wed Nov 28 22:43:56 CET 2007


Irina, you must have them in character format. You need to convert to Date type.

mydates = as.Date(mydates, "%m/%d/%Y")

HTH.

Horace

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Irina Burmenko
Sent: Wednesday, November 28, 2007 11:44 AM
To: Horace Tso; r-help at r-project.org
Subject: [R] Dates in R

Hi,

I have dates in the following format: 4/8/2006 (MM/DD/YYYY).  I need to have R compare date A to date B to figure out which one is more recent.  Is there a way to do that?  Simply using the '>' or '<' signs doesn't seem to work.  I think in this case R treats '/' as a division sign and gives me erroneous results.

Thanks a lot for your help.
Irina


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.

        [[alternative HTML version deleted]]

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



More information about the R-help mailing list