Re: [R] Getting the numeric value of difftime

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Sat 14 Jan 2006 - 00:26:12 EST

just try

as.numeric(difftime(date1, date2))

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


> Hi folks,
>
> I have a small, maybe newbie, question concerning date operations.
> The follwing snippet
>
> date1 = "2005-11-20";
> date2 = "2005-11-17";
> difftime(date1, date2)
>
> results in "Time difference of 3 days". How can I extract just the
> numerical value 3?
> As a workaround I apply mean() on the result which gives me just a
> numerical value.
>
> Thanks a lot,
>
> Christian
>
> ______________________________________________
> 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
>

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



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 Sat Jan 14 01:26:46 2006

This archive was generated by hypermail 2.1.8 : Sat 14 Jan 2006 - 06:07:39 EST