From ripley at stats.ox.ac.uk  Tue Jul 26 11:06:22 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 26 Jul 2005 10:06:22 +0100 (BST)
Subject: [Rd] density() fails if x contains Inf or -Inf (PR#8033)
In-Reply-To: <20050725131248.5C50CA24F@slim.kubism.ku.dk>
References: <20050725131248.5C50CA24F@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.61.0507261004190.23862@gannet.stats>

The underlying problem here BTW is that sum is promoting logical to double 
not integer, unlike the rest of its Summary group.  This is an 
unintentional side effect of a bug fix a while back, and I have now 
corrected it.

On Mon, 25 Jul 2005 michael.beer at unifr.ch wrote:

> Full_Name: Michael Beer
> Version: 2.1.0 and 2.1.1
> OS: linux-gnu and mingw32
> Submission from: (NULL) (134.21.49.141)
>
>
> The command "density(c(0.5,0.6,Inf,0.7))" fails saying "Wrong type for argument
> 2 in call to massdist". This problem can be resolved by replacing "nx = nx" by
> "nx = as.integer(nx)" in the call to massdist. When there are infinite values,
> the value of sum(x.finite) is attributed to nx before. Thus nx is changed to
> class "numeric" instead of "integer".

-- 
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] density() fails if x contains Inf or -Inf (PR#8033)
Prof Brian Ripley