If X or Y contains missing values, _you_ supplied missing values as the
'lims' argument and it will be those missing values that are reported.
I do not see how you expect to be able to do density estimation with
missing values: they are unknown and so no part of the answer is known. If
you are prepared to omit them, you can do so but my software (if this is
indeed kde2d from package MASS, uncredited) does not make such arbitrary
choices for you.
On Fri, 10 Aug 2007, Jennifer Dillon wrote:
> Hello!
>
> I am trying to do a smooth with the kde2d function,
That is not what the only kde2d function I know of does.
> and I'm getting an error message about NAs. Does anyone have any
> suggestions? Does this function not do well with NAs in general?
>
> fit <- kde2d(X, Y, n=100,lims=c(range(X),range(Y)))
>
> Error in if (from == to || length.out < 2) by <- 1 :
> missing value where TRUE/FALSE needed
>
>
> Thanks in advance!!
>
> Jen
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
PLEASE do as we ask.
--
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