[Rd] %OS on output

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Feb 24 18:02:29 CET 2016


On Wed, Feb 24, 2016 at 10:40 AM, Suharto Anggono Suharto Anggono via
R-devel <r-devel at r-project.org> wrote:
> 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.
>
That's because n = 0 _is_ used, and appears to have always been the
default (since the logic was added in r37395).  So this appears to be
a typo in the documentation (the comment about "n=3" when digits.secs
is unset was added in r37439).

>> getOption("digits.secs")
> NULL
>> z <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS")
>> format(z, "%OS")
> [1] "16"
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2016 | www.rinfinance.com



More information about the R-devel mailing list