[Rd] density(), with argument of length 1 (PR#2593)

u9801539@leonard.anu.edu.au u9801539@leonard.anu.edu.au
Sat Mar 1 06:37:04 2003


The following is from version 1.6.2 of R under Windows,
or 1.6.1 under Mac OSX/X11

> density(1)
Error in if (!(lo <- min(hi, IQR(x)/1.34))) (lo <- hi) || (lo <- abs(x[1])) ||  : 
        missing value where logical needed

I am not sure how this should be handled.  I encountered it
in connection with densityplot().  In that connection, it
might be enough to modify density() so that it returns NA 
is these circumstances.  The following demonstrates the 
implications for densityplot().

> data(mtcars)
> attach(mtcars)
> x11()
> densityplot(~mpg | carb)
Error in if (!(lo <- min(hi, IQR(x)/1.34))) (lo <- hi) || (lo <- abs(x[1])) ||  : 
        missing value where logical needed

John Maindonald                     email : john.maindonald@anu.edu.au
Centre for Bioinformation Science,  phone : (6125)3473        
c/o MSI,                            fax   : (6125)5549 
John Dedman Mathematical Sciences Building (Building 27)
Australian National University
Canberra ACT 0200
Australia