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 _________________________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 27 Apr 2002, 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. >The first step is the traceback() function, which lists the function that "[<-" was called from, the function that was called from, and so on up to the source() function. It may then be obvious where to look. Assignment functions are initially even more obscure than other functions because what you see is not the actual call. The actual call would have been somevector[!test]<- rep(no, length = length(ans))[!test] and while you can't work out the name of the vector, the rest may look familiar. Finally, in R1.5.0 look at the recover() function options(error=recover) launches the browser when an error occurs, and options(error=NULL) turns this off. In older versions of R, or for saving debugging information for later examination look at dump.frames() and debugger(). -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._