Programming style rules
Clean code, happy life.
- Save files in Unicode (UTF-8), Unix (LF).
- Preferred editors are BBEdit, Atom, and vim.
- Indent with 4 spaces, auto-expand tabs.
- Maximum of 80 characters per line.
- snake_case for file names.
- Avoid abbreviations and acronyms whenever possible (e.g.
identifier instead of
- Variables with single word acronyms should be lowercase (e.g.
rna instead of
- Write code using RStudio. It has great built-in support for proper indentation and RMarkdown.
- Follow the Bioconductor style guide for package development.
- Hadley’s style guide is also a useful general style reference.
- Periods are reserved for base R definitions.
- Use descriptive variable names.
- Avoid naming variables after functions, whenever possible.
- Use nouns for variables, verbs for functions.
- Use spaces in between definitions.
- camelCase all variable names, including acronyms. Science has many mixed-case acronyms (e.g. mRNA, RNAi), which can be problematic for consistent naming. We recommend following this naming format with camelCase:
- For logicals, explicitly write out
FALSE, instead of using