Debugging Your Code
In This Chapter
Discovering what warnings tell you
Reading errors correctly
Finding the bugs in your code
Optimizing your debugging strategies
To err is human, and programmers fall into that “human” category as well (even though we like to believe otherwise!). Nobody manages to write code without errors, so instead of wondering if you have errors in your code, you should ask yourself where you have errors in your code. In this chapter, you discover some general strategies and specific tools to find that out.
Knowing What to Look For
A bug is simply another word for some kind of error in your program. So, debugging doesn’t involve insecticides — it just means getting rid of all type of semantic and/or logical errors in your functions.
Before you start hunting down bugs, you have to know what you’re looking for. In general, you can divide errors in your code into three different categories:
Syntax errors: If you write code that R can’t understand, you ...