> in tryCatch define an error handler > > error = function(e){ > > text <- print(e) # surely there must be better ways > > # parse text for substring 'optim' or more strongly characteristic > substrings
Note that print() should aways return its 'x' argument, so 'text' and 'e' will be identical here. conditionMessage(e) will give the error message (a character string) and conditionCall(e) will give the call (a language object) to the function which threw the error. You probably want to use grep on conditionMessage(e). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Michael Meyer > Sent: Thursday, September 26, 2013 8:50 AM > To: r-help@r-project.org > Subject: [R] How to catch errors regarding the hessian in 'optim' > > I am weighing in even though I know nothing. > > in tryCatch define an error handler > > error = function(e){ > > text <- print(e) # surely there must be better ways > > # parse text for substring 'optim' or more strongly characteristic > substrings > # you have already seen to emerge from optim > # do what you have to do if such is detected > } > > > Sorry if this answer seems trivial. > > Michael Meyer > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.