-
Notifications
You must be signed in to change notification settings - Fork 25
Coding standards
Antoine Filipovic-Pierucci edited this page Feb 25, 2017
·
8 revisions
- Try to divide the code in meaningful functions, write bricks not monoliths.
- When adding a feature think whether it can be a particular case of a more generic operation.
- Keep the functions as simple as possible. Instead of adding an option, think about what was forcing you to add that option (Doug McIlroy).
- When appropriate, try to follow the tidy tools manifesto.
- Use Hadley Wickham style guide; use snake_case variable naming.
- Write tests for all the features you add with the
testthat
package; test the package withR CMD check --as-cran
. - Document all your functions with the
roxygen
package. Useroxygen >= 0.6.0
syntax. - Only export functions needed by the user. For simplicity of use keep the number of exported functions as low as possible. Consider using generics.
- Use S3 generics. Avoid S4.