Skip to content
George G. Vega Yon edited this page Jan 13, 2017 · 25 revisions

Coding Standards

  1. The 80 characters rule.
  2. When possible, structure your code as sections/files, with files holding similar functions and sections to give internal structure to your file.
  3. Use indenting
  4. Explain yourself: Add comments.

Actual coding

Control-flow statements

# If it's only a single like
if (...)
  ...then...

# Several blocks
if (...) {
  ...then...
} else {
  ...
}

Variable/Objects names

  1. Never use dots to name objects, e.g. my.object
  2. Whenever possible, use informative names, e.g. loglike instead of var1

R-packages

  1. Use devtools
  2. Use travis-ci
  3. Use roxygen
  4. Use testthat + codecov

Useful references

  • The Art of R programming
  • R packages
Clone this wiki locally