[R] Error messages

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Jan 4 17:00:31 CET 1999

Lorenz Gygax <lgygax at access.unizh.ch> writes:

> Dear all,
> The following works with a simple result of lm but gives the error with a
> more complicated one (could this be due to singularities that occurr in
> the model?).
> > cooks.distance (X)
> Error: NAs in foreign function call (arg 6)
> > class (X)
> [1] "lm"
> But, actually, I would like to ask a more general question: Is there a
> place (I searched in the CRAN site) where I find information on what the
> error means? It seems to tell me pretty exactly where the problem lies
> (foreign function call arg6) but I don't understand it. 

Well, one of the things that R does not have is a centralised database
of error messages. *Next* time one invents a statistical programming
language, perhaps this would be something to consider...

Anyways, the error here means that a .Fortran or .C call had missing
values in one of the arguments. Probably in lm.influence's

    .Fortran("lminfl", lm.obj$qr$qr, n, n, k, lm.obj$qr$qraux, 
        lm.obj$coefficients, e, hat = double(n), coefficients = matrix(0, 
            nr = n, nc = k), sigma = double(n), DUP = FALSE)

the 6th arg of "lminfl" would be lm.obj$coefficients, so I suspect
your guess is correct when you say that singularities could be the

Take a look at help(traceback) and help(debug) to see how to find the
source of error messages.

[I seem to recall that there's a reason why lm.fit sticks in NA
(rather than zero) for undetermined coefficients, but I can't offhand
remember it. I suppose that lm.influence() would make sense even for
singular designs, so the current behaviour is likely a bug, not a

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
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