[R] Google's R Style Guide

Tobias Verbeke tobias.verbeke at openanalytics.be
Mon Aug 31 16:20:33 CEST 2009


Vitalie S. wrote:
> On Fri, 28 Aug 2009 16:40:53 +0200, Kevin Wright <kw.stat at gmail.com> wrote:
> 
>> On Fri, Aug 28, 2009 at 8:22 AM, Ted Harding
>> <Ted.Harding at manchester.ac.uk>wrote:
>>
>>> On 28-Aug-09 12:59:24, Esmail wrote:
>>> > Perhaps most of you have already seen this?
>>> >
>>> > http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html
>>> >
>>> > Comments/Critiques?
>>> >
>>> > Thanks,
>>> > Esmail
>>> >
>>> > ps: Reminds me of PEP 8 for Python
>>> >
>>> >      http://www.python.org/dev/peps/pep-0008/
>>> >
>>> > Maybe not that surprising since Python is also one of the main
>>> > languages used by Google.
>>>
>>> I think it is grossly over-prescriptive. For example:
>>>  "function names have initial capital letters and no dots"
>>> is violated throughout R itself.
>>>
>>> Ted.
>>>
>>
>> Certainly R's function names are an inconsistent mess:
>>
>> row.names, rownames
>> browseURL, contrib.url, fixup.package.URLs
>> package.contents, packageStatus
>> mahalanobis, TukeyHSD
>> getMethod, getS3method
>>
>> It's too late to fix the established functions, but it would be nice 
>> to have
>> more reliable and sensible standards going forward into the future.

I agree, but on the other hand one should not overestimate the 
importance of the "inconsistent mess".

A good IDE (such as Eclipse + StatET) provides content assist
for R that takes away the burden both of remembering and correctly 
spelling R functions (and function arguments).

> It's never too late - it's only a name  not a code - search replace 
> through the whole R code and have old names deprecated is not a big 
> deal, isn't it?

?

Best,
Tobias




More information about the R-help mailing list