Chapter 10
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 types 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 have syntax errors. Syntax errors always result in an error message and often are caused by misspelling ...
Get R For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.