Creation Date: Antiquity.
Last Edit Date: 18 Feb 2014.
Using similar coding style helps people understand code. These
guidelines are really just preferences; they are not enforced.
- Use 4 spaces for indenting. No tabs.
- No lines longer than 80 characters.
- Use camelCaps: initial lowercase, then alternate case between words.
- Use camelCaps: initial lower case, then alternate case between words.
- Do not use ‘.’ (in the S3 class system,
x is class
A will dispatch to
- Use CamelCaps: initial upper case, then alternate case between
Use of space
- Always use space after a comma. This:
a, b, c.
- No space around “=” when using named arguments to functions. This:
- Space around all binary operators:
a == b.
- Use “##” to start full-line comments.
- Indent at the same level as surrounding code.
- Import all symbols used from packages other than “base”. Except for
default packages (base, graphics, stats, etc.) or when overly
tedious, fully enumerate imports.
- Export all symbols useful to end users. Fully enumerate exports.
- For conditional package use, see
= for assignment.