[R] Manipulating dates

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Jun 14 16:18:52 CEST 2005


try this:

x <- c("28/03/2000", "27/08/2001", "29/05/2002", "15/12/2003")
y <- as.Date(x, "%d/%m/%Y")
y - min(y)

I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Richard Hillary" <r.hillary at imperial.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, June 14, 2005 4:07 PM
Subject: [R] Manipulating dates


> Hello,
>          Given a vector of characters, or factors, denoting the date 
> in
> the following way: 28/03/2000, is there a method of
> 1) Computing the earliest of these dates;
> 2) Using this as a base, then converting all the other dates into 
> merely
> the number of days after this minimum date
> Many thanks
> Richard Hillary
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list