[Rd] ROBUSTNESS: a:b to give an error when length(a) > 1 or length(b) > 1 - not just a warning

2018-09-01 Thread Henrik Bengtsson
For the construct a:b, we get an error if either 'a' or 'b' is empty, e.g. > x <- integer(0) > x:3 Error in x:3 : argument of length 0 > 3:x Error in 3:x : argument of length 0 However, for length(a) > 1 or length(b) > 1, we only get a warning; > x <- 1:2 > x:3 [1] 1 2 3 Warning in x:3 : In

Re: [Rd] True length - length(unclass(x)) - without having to call unclass()?

2018-09-01 Thread Dénes Tóth
The solution below introduces a dependency on data.table, but otherwise it does what you need: --- # special method for Foo objects length.Foo <- function(x) { length(unlist(x, recursive = TRUE, use.names = FALSE)) } # an instance of a Foo object x <- structure(list(a = 1, b = list(b1 = 1,

Re: [Rd] Segfault when performing match on POSIXlt object

2018-09-01 Thread Marco Giuliano
Thanks a lot ! Best, Marco On Sat, Sep 1, 2018 at 2:48 PM Kurt Hornik wrote: > > Marco Giuliano writes: > > Thanks. Should be fixed in the trunk with c75224: will close the PR > after more testing. > > Best > -k > > > Bug report submitted : > >

Re: [Rd] Segfault when performing match on POSIXlt object

2018-09-01 Thread Kurt Hornik
> Marco Giuliano writes: Thanks. Should be fixed in the trunk with c75224: will close the PR after more testing. Best -k > Bug report submitted : > https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17459 > Thanks! > On Fri, Aug 31, 2018 at 6:48 PM Martin Maechler > wrote: >> >

Re: [Rd] Argument 'dim' misspelled in error message

2018-09-01 Thread Kurt Hornik
> Hervé Pagès writes: Thanks: fixed in the trunk with c75223. Best -k > Hi, > The following error message misspells the name of > the 'dim' argument: >> array(integer(0), dim=integer(0)) >Error in array(integer(0), dim = integer(0)) : > 'dims' cannot be of length 0 > The name of

Re: [Rd] ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1

2018-09-01 Thread Hugh Parsonage
I would add my support for the change. >From a cursory survey of existing code, I'd say that usage like `class(x) == 'y'` -- rather than inherits(x, 'y') or is.y -- is probably going to be the major source of new warnings. So perhaps in the NEWS item it could be noted as a clue for developers