Re: [R] Time rather than dates?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 30 May 2006 - 22:30:38 EST

Try using the "times" class in the chron package.

> library(chron)
> times(c("01:02:03","02:03:04"))

[1] 01:02:03 02:03:04

On 5/30/06, Robert Lundqvist <Robert.Lundqvist@ltu.se> wrote:
> Using strptime() and other functions for dates has been very helpful with
> the kind of data I often work with. However, I haven't found out how time
> as such should be specified. All my attempts result in time *and* date:
>
> >treatment_time<-c("01:02:03","02:03:04") # hours:minutes:seconds
> >time.2<-strptime(treatment_time,format="%H:%M:%S")
>
> >time.2
> [1] "1900-01-01 01:02:03" "1900-01-01 02:03:04"
>
> Why the 1900-...? I had hoped for some easy conversion from time to
> numeric data and possibly back. Assistance would be appreciated.
>
> Robert
>
> ______________________________________________
> 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 May 30 22:35:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 31 May 2006 - 00:10:26 EST.

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