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))
lines(lowess(xdat[good],ydat[good],f=.5),col=3)
Refusing to handle NAs is the usual default behaviour of functions. Some
functions have na.action= arguments to control this, but lowess doesn't.