This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Style Guide
wolfgangmauerer edited this page Oct 30, 2013
·
7 revisions
Please follow google's style guide for R (see http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html), except in the following cases:
- Function names are of the form
do.something.stupid
, notDoSomesthingStupid
- Constants are of the form
A.SUPER.CONSTANT
, notkASuperConstant
- Comments on the same line as source codes start with a single hash sign (
#
); comments on an own line start with two hash signs (##
). Rationale: ftp://ftp.stat.math.ethz.ch/ESS/ESS_html-o/ess_7.html#SEC54 - General function comments (scope, parameters, return values) should be placed on top of the function, not inside it.
- The Queen's English (in her role as Queen of Great Britain, not of the oversee dominions) is preferred over new-world variants.
- Using tabs instead of spaces
- Opening brace of a function immediately follows function parameter list, that is,
test <- function(x,y){
should betest <- function(x,y) {
- Stray whitespace at the end of lines (please avoid this; it makes integration more difficult because albeit lines look identical in editors, they are not for diff and patch
- Surrounding function parameters with spaces. Instead of
return ( value )
, writereturn(value)
- Using loooooooooong lines with >>> 80 chars.
Use the standard conventions outlined on python.org