[R] Google's R Style Guide
John Sorkin
jsorkin at grecc.umaryland.edu
Fri Aug 28 17:02:19 CEST 2009
I am troubled by the curly brace "rule":
An opening curly brace should never go on its own line and should always be followed by a new line; a closing curly brace should always go on its own line.
It seems to me that the opening an dosing curly brace should go on their own lines to allow the reader to immediately know what is encompassed in the curly brace:
Rather than:
if (y < 0 && debug) {
message("Y is negative")
}
How about (note use of separate line for braces and use of indentation):
if (y < 0 && debug)
{
message("Y is negative")
}
Am I missing something regarding the R parser or syntax?
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
>>> hadley wickham <h.wickham at gmail.com> 8/28/2009 10:41 AM >>>
> Perhaps most of you have already seen this?
>
> http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html
>
> Comments/Critiques?
I made my own version that reflects my personal biases:
http://had.co.nz/stat405/resources/r-style-guide.html
Hadley
--
http://had.co.nz/
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}
More information about the R-help
mailing list