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  

Help me defray hosting costs:

Bitcoin: 18HZKcq62P35CSwGatopzeRQLu6SsB1Pw5

Unless otherwise stated, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. Privacy policy

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

Special Projects:

Blogs I like: