R is a high-level programming language used primarily for statistical computing and graphics. The goal of theR Programming Style Guide is to make our R code easier to read, share, and verify. The rules below weredesigned in collaboration with the entire R user community at Google.File Names: end in .R1.Identifiers: variable.name, FunctionName, kConstantName2.Line Length: maximum 80 characters3.Indentation: two spaces, no tabs4.Spacing5.Curly Braces: first on same line, last on own line6.Assignment: use <-, not =7.Semicolons: don't use them8.General Layout and Ordering9.Commenting Guidelines: all comments begin with #followed by a space; inline comments needtwo spaces before the #10.Function Definitions and Calls11.Function Documentation12.Example Function13.TODO Style: TODO(username)14.attach: avoid using it1.Functions: errors should be raised using stop()2.Objects and Methods: avoid S4 objects and methods when possible; never mix S3 and S43.Notation and Naming1.File NamesFile names should end in .Rand, of course, be meaningful.GOOD: predict_ad_revenue.RBAD: foo.RIdentifiersDon't use underscores ( _) or hyphens ( -) in identifiers. Identifiers should be named accordingto the following conventions. Variable names should have all lower case letters and wordsseparated with dots (.); function names have initial capital letters and no dots (CapWords);constants are named like functions but with an initial k.Google's R Style Guidehttp://google-styleguide.googlecode.com/svn/trunk/google-r-style.html1 of 64/5/2011 10:11 AM
has intentionally blurred sections.
Sign up to view the full version.