Re: [R] question about date's

From: ronggui <042045003_at_fudan.edu.cn>
Date: Mon 12 Dec 2005 - 23:13:49 EST


This is one way to do it.
> x<-c("2005-07-01", "2005-07-02","2005-07-03","2005-07-04","2005-07-05")
> x

[1] "2005-07-01" "2005-07-02" "2005-07-03" "2005-07-04" "2005-07-05"
> substr(x,1,4)
[1] "2005" "2005" "2005" "2005" "2005"
> substr(x,6,7)

[1] "07" "07" "07" "07" "07"
> substr(x,9,10)

[1] "01" "02" "03" "04" "05"
>

>Hi,
>
>Given a frame with calendar date's:
>
>"2005-07-01", "2005-07-02","2005-07-03","2005-07-04","2005-07-05",etc.
>
>I want to extract the following from these dates:
>
>week number
>month number
>year number
>
>Any ideas how to accomplish this?
>
>Many thanks.
>
>Regards,
>Richard
>
>______________________________________________
>R-help@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

2005-12-12



Deparment of Sociology
Fudan University

My new mail addres is ronggui.huang@gmail.com Blog:http://sociology.yculblog.com



R-help@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 Received on Mon Dec 12 23:22:23 2005

This archive was generated by hypermail 2.1.8 : Tue 13 Dec 2005 - 02:27:48 EST