[Rd] Misinformative error message for vector()

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 21 09:46:27 CET 2008


Easy to fix, and less serious than

> vector("list", length=NaN)
list()

On Sun, 20 Jan 2008, Henrik Bengtsson wrote:

> Nothing serious, but I just noticed that if you pass a function as the
> 'length' argument of vector(), you get the following misinformative
> error message:
>
>> vector("list", length=function() {})
> Error in vector("list", length = function() { :
>  negative length vectors are not allowed
>
> whereas if you for instance do:
>
>> vector("list", length="foo")
> Error in vector("list", length = "foo") :
>  unimplemented type 'character' in 'asVecSize'
>
> which is more informative.
>
> /Henrik
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list