From jennifer.s.lyon at gmail.com  Thu Dec 15 17:33:30 2016
From: jennifer.s.lyon at gmail.com (Jennifer Lyon)
Date: Thu, 15 Dec 2016 09:33:30 -0700
Subject: [Rd] print.POSIXct doesn't seem to use tz argument,
	as per its example
Message-ID: <CAKstpn7h88=OUpNjV6ZKCEbivWTZfAqhEDAzj01wodBYdcJThQ@mail.gmail.com>

On the documentation page for DateTimeClasses, in the Examples section,
there are the following two lines:

format(.leap.seconds)         # the leap seconds in your time zone
print(.leap.seconds, tz = "PST8PDT")  # and in Seattle's

The second line (using print) seems to ignore the tz argument, and prints
the dates in my time zone, while:

format(.leap.seconds, tz = "PST8PDT")

does print the dates in PST. The code in
https://github.com/wch/r-source/blob/trunk/src/library/base/R/datetime.R
around line 234 looks like the ... argument is passed to print, not to
format.

print.POSIXct <-
print.POSIXlt <- function(x, ...)
{
    max.print <- getOption("max.print", 9999L)
    if(max.print < length(x)) {
        print(format(x[seq_len(max.print)], usetz = TRUE), ...)
        cat(' [ reached getOption("max.print") -- omitted',
            length(x) - max.print, 'entries ]\n')
    } else print(if(length(x)) format(x, usetz = TRUE)
                 else paste(class(x)[1L], "of length 0"), ...)
    invisible(x)
}

The documentation for print() on this page seems to be silent on tz as an
argument, but I do believe the example using print() does not work as
advertised.

Thanks.

Jen
sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

	[[alternative HTML version deleted]]



[Rd] print.POSIXct doesn't seem to use tz argument, as per its example
Jennifer Lyon