[R] Microseconds for a zoo object?

From: Creighton, Sean <sean.creighton_at_citi.com>
Date: Thu, 08 May 2008 14:58:01 +0100


Hello

I have a string which contains microseconds, can anyone help on constructing this in to a time object, with the microseconds, that I can take to a ZOO file?

Thanks
Sean

> UK[1,3]

[1] "17:09:53.824"
> UK[1,1]

[1] "2007-12-11 00:00:00"
> mydates <- paste( substr(UK[,1], 1, 10), UK[,3])
> mydates[1]

[1] "2007-12-11 17:09:53.824"
> is(mydates)

[1] "character" "vector"
> dt1 <- as.POSIXct(strptime(as.character(mydates),"%Y-%m-%d
%H:%M:%S",tz="GMT"))
> dt1[1]

[1] "2007-12-11 17:09:53 GMT"
> is(dt1)

[1] "POSIXt" "oldClass" "POSIXct" "POSIXlt"
>
>



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 Thu 08 May 2008 - 14:01:38 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 Thu 08 May 2008 - 15:00:35 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