Posted on Thu 13 August 2009

Google’s R Style Guide

The more I use R, the more I have to agree with the attach() rule. Here’s the complete list
Summary: R Style Rules
# File Names: end in .R
# Identifiers:, FunctionName, kConstantName
# Line Length: maximum 80 characters
# Indentation: two spaces, no tabs
# Spacing
# Curly Braces: first on same line, last on own line
# Assignment: use <-, not =
# Semicolons: don’t use them
# General Layout and Ordering
# Commenting Guidelines: all comments begin with # followed by a space; inline comments need two spaces before the #
# Function Definitions and Calls
# Function Documentation
# Example Function
# TODO Style: TODO(username)
# attach: avoid using it
# Functions: errors should be raised using stop()
# Objects and Methods: avoid S4 objects and methods when possible; never mix S3 and S4  

This work is licensed under a Creative Commons Attribution License.

Disclaimer: This website is not affiliated with any of the organizations or institutions to which Diego Valle-Jones belongs. All opinions are my own and should never be taken seriously.

Blogs I like: