michael.beer@unifr.ch
2005-Jul-25 13:12 UTC
[Rd] density() fails if x contains Inf or -Inf (PR#8033)
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".
Prof Brian Ripley
2005-Jul-26 09:06 UTC
[Rd] density() fails if x contains Inf or -Inf (PR#8033)
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