Re: [Rd] Date method of as.POSIXct does not respect tz

2018-05-18 Thread Roland Fuß


Am 17.05.2018 um 19:55 schrieb Martin Maechler:

Roland Fuß
on Wed, 16 May 2018 17:21:07 +0200 writes:


> R 3.5.0 Is it intended that the Date method of as.POSIXct
> does not respect the tz parameter? I suggest changing
> as.POSIXct.Date

which is

 function (x, ...) .POSIXct(unclass(x) * 86400)

> to this:

function (x, tz = "", ...)
 .POSIXct(unclass(x) * 86400, tz = tz)

or rather just forward the '...', i.e., use

function (x, ...) .POSIXct(unclass(x) * 86400, ...)

??


Then .POSIXct should gain the ellipses as an argument if you don't want 
to break code that relies on as.POSIXct.Date accepting superfluous 
arguments.


Btw. I think it's a bit unfortunate that as.POSIXct and as.POSIXlt don't 
throw an error when passed an invalid timezone string. But that would be 
more difficult to change.




> Currently, the best workaround seems to be using the
> character method if one doesn't want the default timezone
> (which is often an annoying DST timezone).

> This came up on Stack Overflow:
> https://stackoverflow.com/q/50373340/1412059

> --
> Roland

Thank you Roland for your notice (and the help on SO).


Thank you and the rest of R-core for maintaining and improving one of my 
work tools and my favorite programming language!




Best,
Martin



--
Roland

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error message truncation

2018-05-18 Thread Michael Chirico
Help pages for stop/warning reference the option "warning.length", e.g.
from ?stop:

Errors will be truncated to getOption("warning.length") characters, default
> 1000.


Essentially the same is in ?warning.

Neither of these mention the hard-coded limits on the acceptable values of
this option in options.c

:

if (streql(CHAR(namei), "warning.length")) {
  int k = asInteger(argi);
  if (k < 100 || k > 8170)
  error(_("invalid value for '%s'"), CHAR(namei));
  R_WarnLength = k;
  SET_VECTOR_ELT(value, i, SetOption(tag, argi));
}

Further, it appears there's a physical limit on the length of the error
message itself which is only slightly larger than 8170:

set.seed(1023)
NN = 1L
str = paste(sample(letters, NN, TRUE), collapse = '')
# should of course be 1
tryCatch(stop(str), error = function(e) nchar(e$message))
# [1] 8190

My questions are:


   - Can we add some information to the help pages indicating valid values
   of options('warning.length')?
   - Is there any way to increase the limit on error message length? I
   understand having such a limit is safer than potentially crashing a system
   that wants to print a massive error string.

This came up in relation to this SO Q&A:

https://stackoverflow.com/a/50387968/3576984

The user is submitting a database query; the error message will first
reproduce the entirety of the query and then give some diagnostic
information. Queries can get quite long, so it stands to reason that this
8190-length limit might be binding.

Thanks,
Michael Chirico

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel