Lesson 13 · Debugging variable type errors

What you will learn in this lesson

- How to debug type errors
- How to interact with the console
- How to find the type of a variable
- How to change the type of a variable

We saw in lesson 2 that debugging is an integral part of writing code. In my experience, the most common bug in R is related to variable types. We saw what types are in lesson 5.

Sadly for us, there is no “general theory of type errors”. There is no silver bullet to debug them. Instead, we need to be meticulous and organized. This lesson provides a bunch of useful tools and techniques to make debugging variable type errors easier.