R style guide

August 13, 2009 in Math

Google has posted a style guide for R which is being used throughout the organization. It's mostly in line with what I learned once upon a time, but it's nice to see such an authoritative body coming out with a set of standards. Universal coding benefits everyone, and R is growing so rapidly that some form of standardization is becoming necessary.

A couple bullets:

  • File names: end in .R
  • Identifiers: variable.name, FunctionName, kConstantName
  • Indentation: two spaces, no tabs
  • Curly Braces: first on same line, last on own line
  • Assignment: use <-, not =
  • Semicolons: don't use them

The full guide is available here.

(via Revolutions)

Leave a Comment

Previous post:

Next post: