DA 101, Dr. Ladd
Week 7
Think about what you were trying to do vs. what happened instead. Create a hypothesis for what went wrong.
Look for a line number where the error is occurring.
Sometimes the bug is in the line before the one that threw the error!
Sometimes you ran something out of order. Go back to the beginning of your code and re-run to see if that will fix it.
Try your best to explain the problem out loud, preferably to a friend or teammate.
Practice rubber duck debugging.
If you’re lost, refer to all the resources you have: cheatsheets, lab guides, online documentation.
And when in doubt: Google the error message and see if someone else had the same problem!
Don’t let a single bug frustrate you for too long. If none of the above strategies worked, ask a classmate, TA, or instructor for help with the problem.
Remember, your RMarkdown won’t knit if there are bugs. This is a great way to find them early.
Name your variables and dataframes with care. Rename things to make them more clear. Good names can help you find a problem quickly.
Don’t try to write a whole program all in one go.
Check that it works as you go.
Use #
to leave comments: remind yourself what certain lines of code are doing.
Practice Defensive Programming
Follow Style Guides: