Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.03.9901281026580.16506-100000@wompom.biostat.washington.edu>
Date: 1999-01-28T18:30:55Z
From: Thomas Lumley
Subject: NAs spoil lowess smoothing
In-Reply-To: <XFMail.990128121544.s-luppescu@uchicago.edu>

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.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._