[R] date handling
JeeBee
JeeBee at troefpunt.nl
Tue Dec 13 11:26:40 CET 2005
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 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