[Rd] %OS on output

Suharto Anggono Suharto Anggono suharto_anggono at yahoo.com
Wed Feb 24 17:40:53 CET 2016

R help on 'strptime' has the following in "Details" section.
Specific to R is ‘%OSn’, which for output gives the seconds truncated to ‘0 <= n <= 6’ decimal places (and if ‘%OS’ is not followed by a digit, it uses the setting of ‘getOption("digits.secs")’, or if that is unset, ‘n = 3’).

In reality, for output, if '%OS' is not followed by a digit and getOption("digits.secs") is unset, the output has no fractional part, as if n = 0 is used.

> getOption("digits.secs")
> z <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS")
> format(z, "%OS")
[1] "16"

More information about the R-devel mailing list