Skip to content
mdijkstra edited this page Sep 30, 2014 · 13 revisions
  • Please make use of our template for R-scripts
  • No magic in scripts. Use parameter file + command line parameters to indicate file names. Do not manipulate file names in scripts.
  • Avoid the use of global variables from within functions (e.g. with <<-)
  • Functions should have only one task
  • Use tabs for indentation, not spaces
  • Use = for assignments, not <-. This choice is arbitrary (opinions are divided).
  • If main code is in main.R, put its functions in main_functions.R
  • R-scripts are ignorant of their location. Here we explain how to source(main_functions.R)
  • Please note our guidelines for documentation and tests
  • Always use < (smaller than) or <=, never > or >=
  • Always put constants first, e.g. if (1 == my.variable) …
  • See also Google's R-style guide
    • E.g. FunctionName (we allow functionName and function.name too), file_name.R, variable.name
Clone this wiki locally