Best Practice: What and Why
In R there are many ways do get the job done. None of these are bad - the right code is the code that works. That said, knowing what is best practice and striving to keep it has big benefits:
Your code will be easier to write (less decisions for you to make)
Your code will be easier to read and maintain (other people will be familiar with the conventions you use)
You will improve as an analyst and developer
DfE Standards for R
Wherever possible, as an organisation we seek to defer to industry standards rather than creating our own. Broadly, we therefore recommend:
R for Data Science (2e) for best-practice essentials
The Tidyverse style guide for a more rigorous overview of code styling
A Best Practice Cheatsheet
For a quick primer on best-practice you can refer to the following cheatsheet: