[R-sig-eco] documentation available that further explains error messages?
Ben Bolker
bolker at zoology.ufl.edu
Wed May 7 23:20:20 CEST 2008
A couple more suggestions:
Mark Bravington's "debug" package (mvbdebug, available
on CRAN) can be a more powerful debugging tool if you
want to do a more graphical stepping-through your code;
a cruder but effective technique is to put a cat()
statement into your objective function, e.g.
objfun <- function(params,...) {
## calculate neg log likelihood
neg.log.likel <- ...
cat(params[1],params[2],neg.log.likel,"\n")
neg.log.likel
}
that way you can see where the function is getting in
trouble.
Kingsford Jones wrote:
> Hi Jeremy,
>
> Since R is open source, the code is usually the best reference when
> you can't decipher an error message. Often the easiest way to see
> what is going on is to type traceback() after receiving the error
> message -- this will show you the calls that led to the error.
>
> Another very useful tool is to type
> debug(name.of.function.to.be.debugged) prior to calling the function
> of interest.
> The next time you use that function, debug will take you step-by-step
> through the function calls while allowing full interactive ability so
> you can, e.g. look at the structure of objects as they are created
> within the function (using, e.g., the str function).
>
> Another option is to open the function's source file in a text window
> and use Find in your text editor to find the error.
>
> Finally, searching for the error message in the help archives can
> often be fruitful. That technique just led me to this:
>
> https://stat.ethz.ch/pipermail/r-help/2006-January/086747.html
>
> which indicates what the '[2]' is referring to.
>
>
> Kingsford Jones
>
>
> On Wed, May 7, 2008 at 12:30 PM, Jeremy Claisse <jclaisse at yahoo.com> wrote:
>> I'm trying to figure out how to overcome this error message:
>>
>> Error in optim(c(5, -0.5), llfunc.prop.female.age, method = "BFGS") :
>> non-finite finite-difference value [2]
>>
>> And particularly would like to know what the "[2]" is pointing towards, I'm
>> assuming that will help me search out the problem. Is there any
>> documentation available that explains the particulars of error messages?
>>
>> Thanks,
>> Jeremy
>>
>> Jeremy Claisse
>> Hawaii Cooperative Fishery Research Unit
>> University of Hawaii
>> <mailto:claisse at hawaii.edu> claisse at hawaii.edu
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20080507/aef9ad29/attachment.bin>
More information about the R-sig-ecology
mailing list