[R] Dates in R

jim holtman jholtman at gmail.com
Wed Nov 28 22:41:38 CET 2007


Convert to Date and then compare;


> x <- as.Date("4/8/2006", "%m/%d/%Y")
> y <- as.Date("5/10/2007", "%m/%d/%Y")
> x>y
[1] FALSE
>

On Nov 28, 2007 2:44 PM, Irina Burmenko <iburmen at yahoo.com> wrote:
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list