[R] Error: NA/NaN/Inf in foreign function call (arg 1)

John Fox jfox at mcmaster.ca
Fri Jun 14 22:55:24 CEST 2002


Dear Sébastien,

At 11:20 AM 6/14/2002 -0400, Sébastien Plante wrote:

>I did
>plot(Mass,HSI)
>
>and it worked fine. However, when I wanted to draw the smooth regression,
>
>scatter.smooth(Mass,HSI)
>
>I got this error:
>
>Error: NA/NaN/Inf in foreign function call (arg 1)
>
>I did not forgot to load the package modreg...
>
>Must I declare the "NAs" before doing this analysis? If so, how?

scatter.smooth doesn't handle missing values. A simple way to proceed is to 
remove the missing data:

         good <- complete.cases(Mass, HSI)
         scatter.smooth(Mass[good], HSI[good])

I hope that this helps,
  John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list