Some best practices when writing code in R
Last updated on 2024-11-19 | Edit this page
Estimated time: 0 minutes
Overview
Questions
- What are some best practices to keep in mind when writing code in R?
Objectives
- Strive to keep files organised in a structured directory
- Be aware of any dependencies for your code
- Produce code which can be reproducible by yourself and others by documenting your code with comments
Key Points
- Keep your files organised in your working directory
- Consider your working directory and what is required to reproduce your code (e.g., packages)
- Be consistent in your naming conventions
- Use
#
to add comments to your code