From epurdom at stanford.edu  Thu Sep  9 18:46:34 2004
From: epurdom at stanford.edu (epurdom@stanford.edu)
Date: Thu Sep  9 18:46:37 2004
Subject: [Rd] hist( ) fails with 'Inf' values unlike plot( ) (PR#7220)
Message-ID: <20040909164634.6267610451@slim.kubism.ku.dk>

Full_Name: Elizabeth Purdom
Version: 1.9.1
OS: Windows
Submission from: (NULL) (171.64.102.192)


hist() fails if encounters 'Inf' value, rather than giving warning and removing.
Other graphics, like plot(), don't have this problem. It's actually rather
confusing if you are taking the log of data real valued data with a few
non-positive numbers. hist() works fine in this situation unless you happen to
have an exact 0, as oppose to just negative numbers. Then log(0)=Inf while
log(-1)=NA and NA values are removed by the program while Inf kills it. At least
a better error message would be good, because as it is, it looks like the
program can't handle NAs. 

> x<-seq(-5,100,by=1)
##Gives error, no output
> hist(log(x))
Error in pretty(range(x), n = breaks, min.n = 1) : 
        NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message: 
NaNs produced in: log(x) 
##Gives log() warning
> hist(log(x)[!is.infinite(log(x))])
Warning messages: 
1: NaNs produced in: log(x) 
2: NaNs produced in: log(x)


[Rd] hist( ) fails with 'Inf' values unlike plot( ) (PR#7220)
epurdom@stanford.edu