[Rd] density() fails if x contains Inf or -Inf (PR#8033)

michael.beer@unifr.ch michael.beer at unifr.ch
Mon Jul 25 15:12:48 CEST 2005

Full_Name: Michael Beer
Version: 2.1.0 and 2.1.1
OS: linux-gnu and mingw32
Submission from: (NULL) (

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".

More information about the R-devel mailing list