Sébastien Plante
2002-Jun-14 15:20 UTC
[R] Error: NA/NaN/Inf in foreign function call (arg 1)
Hi, I have a huge data table with several variables containing missing values. I want to make a simple scatter plot (Mass, HSI) and draw a smooth regression on it. Here are the summaries of these two variables:> summary(Mass)Min. 1st Qu. Median Mean 3rd Qu. Max. 46.0 205.9 272.5 282.6 348.3 610.1> summary(HSI)Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 0.300 1.045 1.350 1.491 1.835 4.270 13.000 So there are 13 missing values in HSI. 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? Thanks, S?bastien Plante -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Maybe Matching Threads
- Requesting help with lattice again
- In da.norm Error: NA/NaN/Inf in foreign function call (arg 2)
- glmmPQL, NA/NaN/Inf in foreign function call (arg 3)
- NA/NaN/Inf in foreign function call (arg 6) error from coxph
- Error message NA/NaN/Inf in foreign function call (arg 6) when using knn()