Variable Naming Conventions

Learn best practices for naming variables to keep code maintainable and readable.

Before moving on to building full models, we’ll take this chapter to focus on best practices for coding data science projects in R. It’s important to remember that in data science, our code is not only written for the computer to execute, but also for other human beings to read and understand. All code needs to be easily understood; if not, our projects will fail. Remember, the best code reads like a book: it’s self-explanatory and self-connecting. We need others to understand our code so they can:

  • Understand our analyses and where our conclusions came from
  • Check for logical errors
  • Debug syntactical issues
  • Help us to improve our algorithms overall

Get hands-on with 1200+ tech skills courses.