Summary: R Style Rules
# File Names: end in .R
# Identifiers: variable.name, 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)
Summary:
# 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
The more I use R, the more I have to agree with the attach() rule. Here’s the complete list
Read Next: