2

I'm an intermediately experienced R user, with a team of R developers. However, I find that when our programs starts growing, it becomes very hard to manage and debug, and work as a team.

I am a C++ / Java / Python user, and though this seems most similar to Python of those three, I still find it hard to deduce from known Java and Python "Best Practices" unto R.

Looking for a book or tutorial discussing coding conventions, and R software engineering principles, maybe OOP stuff?

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
eran
  • 14,496
  • 34
  • 98
  • 144
  • Maybe your question is more suitable for the programmers stackexchange. – Paul Hiemstra Jan 30 '12 at 08:16
  • 4
    You may want to look at [Google's coding guidelines](http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html) or Hadley's [devtools](https://github.com/hadley/devtools/wiki). – Vincent Zoonekynd Jan 30 '12 at 08:41

1 Answers1

6

UPDATE:

There are two more recent books that you definitely need to check out when writing packages:

Advanced R from Hadley Wickham, explaining about environments and other advanced topics.

R Packages from Hadley Wickham, giving a great guide for package writing


There isn't one book or style guide for writing R packages; there are numerous books about R that include package writing etc, and the R internals give you a style guide as well.

R coding standards from R internals

The books that contain the most advanced information about R as a programming language are in my view the following two:

R programming for bioinformatics from Robert Gentleman

Software for data analysis: Programming with R from John Chambers

Both books give a lot of insight in R itself and contain useful style tips. Gentleman focuses on object oriented programming (as Bioconductor is largely S4 based), and Chambers is difficult to read but a rich information mine.

Next to that, you have a lot of information on stackoverflow to get ideas:

Coding practice in R : what are the advantages and disadvantages of different styles?

Function commenting conventions in R

any R style guide / checker?

What is your preferred style for naming variables in R?

Common R idioms

But basically you'll have to sit down with your team and agree on a standard. There's no 'best' way, so you all just have to agree on a good way you all use in order to keep the code consistent.

Community
  • 1
  • 1
Joris Meys
  • 106,551
  • 31
  • 221
  • 263