[R] Explanation of Error Diagnostics

John Fox jfox at mcmaster.ca
Sun Apr 28 15:12:12 CEST 2002


Dear Graham,

Errors and error messages are generated in individual functions by calls to 
the stop function, so documentation of an error message would have to be 
particular to the function that generated the error (unless an effort were 
made to standardize some kinds of messages). As well, since functions 
typically call other functions, unless the calling function catches an 
error, the message generated can be cryptic.

This problem is compounded when you source a file of commands. Specifying 
the argument verbose=TRUE to source will give you much more information, 
helping you to pinpoint the error. If that is insufficient, execute the 
commands individually to the point of the error and call the traceback 
function, which will show you the sequence of function calls culminating in 
the error. There are other debugging tools as well, but what I've suggested 
will probably suffice.

I hope that this helps,
  John

At 12:26 PM 4/27/2002 -0700, graham lawrence wrote:
>Hi,
>
>Is there any documentation to explain R's error diagnostics, e.g. messages 
>like
>
>>source("../src/sources/routine.R")
>Read 8 records
>Read 2 records
>Error in "[<-"(*tmp*, !test, value = rep(no, length = length(ans))[!test]) :
>        incompatible types
>
>The nature of the problem incompatible types, is clear; but I'm more 
>interested in its location, and feel that the cryptic elements
>"[<-"(*tmp*, !test, value = rep(no, length = length(ans))[!test])
>probably hold the key to finding it.
>
>Thanks in advance for your help,
>graham lawrence


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