Re: [R] date handling

From: JeeBee <JeeBee_at_troefpunt.nl>
Date: Tue 13 Dec 2005 - 21:26:40 EST

D = as.POSIXlt(c("2005-07-01", "2005-07-02",   "2005-07-03", "2005-07-04", "2005-07-05"))

> (Years = 1900+D$year)

[1] 2005 2005 2005 2005 2005

> (Months = D$mon+1)

[1] 7 7 7 7 7

> weekdays(D)

[1] "Friday" "Saturday" "Sunday" "Monday" "Tuesday"

# you better check this one carefully !!! (Weeknumbers = floor((D$yday+7)/7))

JeeBee

On Mon, 12 Dec 2005 12:59:11 +0100, Richard van Wingerden wrote:

> 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



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 Tue Dec 13 22:09:00 2005

This archive was generated by hypermail 2.1.8 : Tue 13 Dec 2005 - 23:37:59 EST