From ripley at stats.ox.ac.uk  Mon Jan 21 09:46:27 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 21 Jan 2008 08:46:27 +0000 (GMT)
Subject: [Rd] Misinformative error message for vector()
In-Reply-To: <59d7961d0801202050o2bd08ad4y3ac6131305814c53@mail.gmail.com>
References: <59d7961d0801202050o2bd08ad4y3ac6131305814c53@mail.gmail.com>
Message-ID: <alpine.LFD.1.00.0801210844470.9081@gannet.stats.ox.ac.uk>

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



[Rd] Misinformative error message for vector()
Prof Brian Ripley