[Rd] fractional seconds in POSIXct

From: Sebastian P. Luque <spluque_at_gmail.com>
Date: Wed, 30 May 2012 13:15:31 -0500


Hi,

Using the following simple character vector representing a time series with fractional seconds:

datetime <- c("20/09/2011 13:00:59.00", "20/09/2011 13:00:59.02",

              "20/09/2011 13:00:59.04")

Conversion to POSIXct runs into problems; the second element is not interpreted correctly:

---<--------------------cut here---------------start------------------->---
R> as.POSIXct(strptime(datetime, format="%d/%m/%Y %H:%M:%OS"), tz="GMT")
[1] "2011-09-20 13:00:59.00 GMT" "2011-09-20 13:00:59.01 GMT" "2011-09-20 13:00:59.03 GMT"
R> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:

 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8   
 [6] LC_MESSAGES=en_CA.UTF-8    LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            

[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] diveMove_1.3.4 caTools_1.12 bitops_1.0-4.1 slmisc_0.9.2 latticeExtra_0.6-19 RColorBrewer_1.0-5 lattice_0.20-6
loaded via a namespace (and not attached):
[1] compiler_2.15.0 grid_2.15.0 tools_2.15.0
---<--------------------cut here---------------end--------------------->---

Is this expected? Thanks.

Cheers,

-- 
Seb

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 30 May 2012 - 18:19:47 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 30 May 2012 - 22:42:10 GMT.

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

list of date sections of archive