[R] Converting a 'difftime' to integer - How to???
Martin Hvidberg
martin at hvidberg.net
Wed May 21 22:04:31 CEST 2008
I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like:
> d <- as.Date("2006-03-13") - as.Date("2006-01-01") +1
> d
Time difference of 72 days
So far so good. But d is a 'difftime' object. How do I get an Integer value from that?
I tried severel things, incuding the following:
> dd <- as(d,"numeric")
Error in .classEnv(thisClass) :
unable to find an environment containing class "difftime"
Sugestions appriciated...
:-) Martin at Hvidberg.net
More information about the R-help
mailing list