Re: [R] Converting a 'difftime' to integer - How to???

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Wed, 21 May 2008 17:09:41 -0300

Try :

as.numeric(d)

or also:

unclass(d)

On Wed, May 21, 2008 at 5:04 PM, Martin Hvidberg <martin_at_hvidberg.net> wrote:

> 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
>
> ______________________________________________
> R-help_at_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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


______________________________________________ R-help_at_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.

Received on Wed 21 May 2008 - 20:16:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 21 May 2008 - 21:31:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive