[R] Date conversion
P.Dalgaard at biostat.ku.dk
Thu Nov 13 18:14:41 CET 2008
Dr. Alireza Zolfaghari wrote:
> Hi List,
> If I have a date format as:
> d <- "2001/1/1"
> I can easily convert it to number by using as.Date(d).
Yes. If it means "January the 1st" and not "1st of January", that is...
> But if I have d<-"1/1/2001", it does not work. Does anyone know how I can
> convert it using pre-written function in R?
as.Date has a format= argument. See the Examples section in help(as.Date).
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help