Armstrong, Whit wrote:
> dts <- c("2004-8-1","2004-10-1","2001-9-1")
> strptime(dts,"%Y-%m-%d")
> julian(strptime(dts,"%Y-%m-%d")) 
>
>
>   
Why do people insist on missing the obvious?

> x <- c("2004-8-1","2004-10-1","2001-9-1")
> as.Date(x) - as.Date("1960-1-1")
Time differences in days
[1] 16284 16345 15219

>> -----Original Message-----
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] On Behalf Of zhijie zhang
>> Sent: Thursday, September 13, 2007 8:19 AM
>> To: [EMAIL PROTECTED]
>> Subject: [R] handle dates in R?
>>
>> Dear Rusers,
>>   I have some data in .csv file like "2004-8-1" and 
>> "2004-10-1", and i  need to convert them into days from the 
>> origin (January 1, 1960).
>> I have tried the function date.mmddyyyy(), but cannot get it. 
>> Anybody can show me how to handle the date data?
>>   Thanks very much!
>>
>> My dataset like:
>> time
>> 2004-8-1
>> 2004-10-1
>> 2001-9-1
>> 2002-9-1
>>
>>
>> --
>> With Kind Regards,
>>
>> oooO:::::::::
>> (..):::::::::
>> :\.(:::Oooo::
>> ::\_)::(..)::
>> :::::::)./:::
>> ::::::(_/::::
>> :::::::::::::
>> [*************************************************************
>> **********]
>> Zhi Jie,Zhang ,PHD
>> Tel:86-21-54237149
>> Dept. of Epidemiology,School of Public Health,Fudan 
>> University Address:No. 138 Yi Xue Yuan Road,Shanghai,China
>> Postcode:200032
>> Email:[EMAIL PROTECTED]
>> Website: www.statABC.com
>> [*************************************************************
>> **********]
>> oooO:::::::::
>> (..):::::::::
>> :\.(:::Oooo::
>> ::\_)::(..)::
>> :::::::)./:::
>> ::::::(_/::::
>> :::::::::::::
>>
>>      [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@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.
>>
>>     
>
>
>
>
> This e-mail message is intended only for the named recipient(s) above. It may 
> contain confidential information. If you are not the intended recipient you 
> are hereby notified that any dissemination, distribution or copying of this 
> e-mail and any attachment(s) is strictly prohibited. If you have received 
> this e-mail in error, please immediately notify the sender by replying to 
> this e-mail and delete the message and any attachment(s) from your system. 
> Thank you.
>
>   
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help@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.
>   


-- 
   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
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

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

Reply via email to