[R] strptime() with format %OS does not print millisecs in MacOS

Agustin Lobo Agustin.Lobo at ictja.csic.es
Sun Feb 17 21:01:49 CET 2013


Hi!

I'm finding this on MacOS Lion 10.7.5

> getOption("digits.secs")
NULL

> a <- "2012_10_01_14_13_32.445"
> strptime(a,format="%Y_%M_%d_%H_%M_%OS")
[1] "2012-02-01 14:13:32"
> strptime(a,format="%Y_%M_%d_%H_%M_%OS3")
[1] NA

I can solve it with
> options(digits.secs=3)
> strptime(a,format="%Y_%M_%d_%H_%M_%OS")
[1] "2012-02-01 14:13:32.445"

But is this not in contradiction with the help page?
" if %OS is not followed by a digit, it uses the setting of
getOption("digits.secs"), or if that is unset, n = 3"


Thanks

Agus
PS
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] sp_0.9-99

loaded via a namespace (and not attached):
[1] grid_2.15.1    lattice_0.20-6 tools_2.15.1


--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
e-mail Agustin.Lobo at ictja.csic.es
https://sites.google.com/site/aloboaleu/



More information about the R-help mailing list