[R] NAs spoil lowess smoothing
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Thu Jan 28 23:02:56 CET 1999
On Thu, 28 Jan 1999, Thomas Lumley wrote:
> On Thu, 28 Jan 1999, Stuart Luppescu wrote:
> > Can anyone explain to me what this error message means, why I'm getting it, and
> > how to fix it?
> > lines(lowess(xdat, ydat, f=.5), col=3)
> > Error: NAs in foreign function call (arg 1)
> It means that in a call to .C or .Fortran there are missing values in the
> first argument. The call to .C is inside lowess(), and its first argument
> is the x data. So you're getting it because there are NAs in xdat.
> You can fix it by removing the NAs, eg
> good<-!(is.na(xdat) | is.na(ydat))
> Refusing to handle NAs is the usual default behaviour of functions. Some
> functions have na.action= arguments to control this, but lowess doesn't.
Actually, that message is confusing. There could be Infs or NaNs in xdat
rather than NAs. Thomas is probably right, but this is worth bearing in
mind (says he having searched for ages for NAs in a locfit example).
I would take a look at xdat to see what is unexpected (by you).
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help