For any software application in production and produced by a development team, coding standards are an essential tool for promoting maintainability and quality. Google has recently published their coding standards for R, with a compendium of common-sense tips for keeping an R project in shape. The standards Google R programmers adhere to include:
- File Names: end in .R
- Identifiers: variable.name, FunctionName, kConstantName
- Line Length: maximum 80 characters
- Indentation: two spaces, no tabs
- Curly Braces: first on same line, last on own line
- Assignment: use <-, not =
- Semicolons: don't use them
- Commenting Guidelines: all comments begin with # followed by a space; inline comments need two spaces before the #


Interesting to compare these to the "R Coding Standards" in the R Core Team's R Internals manual. In particular, R Core writes "a basic indentation of 2 ... has been determined not to display the structure clearly enough when using narrow fonts"
Posted by: Rich Calaway | August 13, 2009 at 13:52
so don't use narrow fonts!
Posted by: Tim | August 13, 2009 at 21:28