RLint: Reformatting R Code to Follow the Google Style Guide
Tuesday, 08 July 2014

Google Research has shown off software that will check and reformat R code to conform to the Google R Style Guide.

The project was discussed in a paper given by Andy Chen of Google Research at this year’s R User Conference in Los Angeles.

 

R is rapidly becoming the top language for statistics and data processing in general and it needs to be taken seriously as it is being used to create large systems often by users who aren't primarily programmers. Other languages have "lint" programs designed to remove the irritating "fluff" that obscures meaning and degrades the code - so why not R? 

Chen's talk showed how RLint has been developed by Google to check and reformat R code, warning of violations and optionally changing the layout to produce compliant code.

Code elements RLint looks at include proper spacing, line alignment inside brackets, and other style violations. Chen says RLint is automatically used within Google as part of the peer review process for R code.

The need for consistent coding layout and format within Google is clear when you consider the statistics Chen quotes, saying that within Google around 40 percent of R files are modified by more than one programmer.

Google has an R Style Guide that specifies best practices for naming identifiers; program layout in terms of indentation and spacing; how to comment a program and how to comment functions. The measure of success, according to the guide, is that any programmer should be able to instantly understand structure of any code.

RLint was developed in Python with the goal of minimizing the overhead of following the style guide. When used within Google, all code violations of the style guide are flagged by the code review tool, and violations must be corrected before code submission.

Chen says Google encourages CRAN package authors and other R programmers to use this tool. It is driven from the command line and runs in Linux, Unix, Mac or Windows.

 

More Information

RLint
R Style Guide

Related Articles

R 3.0 - the Masked Marvel

A Programmer's guide to R - Data and Objects

Getting Started with R (book review)

The Art of R Programming (book review)

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

 

Banner


Linus On Linux And Strong Language
19/10/2014

In a recent video made of a Q&A at this year's LinuxCon, Linus Torvalds says some interesting things - including some comments about his interesting robust style. It also gives us the amazing one- [ ... ]



Microsoft Lowers Barrier To Windows Stores
24/09/2014

Microsoft recently launched a new Dev Center Benefits program and now has taken the further welcome step of eliminating annual fees. You still have to pay to register at the Dev Center but this is now [ ... ]


More News

 

blog comments powered by Disqus

Last Updated ( Tuesday, 08 July 2014 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.