Are there any official naming conventions for R? (original) (raw)

Most programming languages have official naming conventions for functions, parameters, classes, etc. Official here means that the conventions are issued by the organization behind the language.

Are there any official naming conventions for R?

I'm aware that naming conventions and R have been discussed before on stackoverflow, but that was some time ago and my question is not "what naming convention do you prefer?" but rather concerns whether official naming conventions exist.

Community's user avatar

asked Apr 4, 2012 at 14:45

Rasmus Bååth's user avatar

Rasmus BååthRasmus Bååth

5,1874 gold badges32 silver badges29 bronze badges

0

The R Developer Page contains "more or less finalized ideas and plans for the R statistical system" from R-core. It does not contain any information about naming conventions. A brief look at the core R code will confirm this.

answered Apr 4, 2012 at 14:57

Joshua Ulrich's user avatar

Joshua UlrichJoshua Ulrich

176k33 gold badges350 silver badges424 bronze badges

1

R-core have a coding standards guide, but this does not include variable naming conventions.

Bioconductor also has a coding standards guide, which recommends lowerCamelCase.

There are links to those and several other style-guides here.

SmallChess's user avatar

SmallChess

8,0519 gold badges56 silver badges94 bronze badges

answered Apr 4, 2012 at 15:03

Richie Cotton's user avatar

Richie CottonRichie Cotton

121k47 gold badges250 silver badges365 bronze badges

3

Check out "The State of Naming Conventions in R" for a good discussion on the topic!

I would like to quote the following:

Both the CRAN data and the style guides show that there is no consensus regarding naming conventions in R and this it likely to continue as naming conventions, to a large degree, are a matter of taste and habit.

What is most important, however, is to keep a consistent naming convention style within your code base, whether you are working on a personal project or developing a package.

Community's user avatar

answered Dec 27, 2013 at 8:27

dwstu's user avatar

2

As other people have answered, there is no official R coding style, but if you are looking for a consistent, well thought out style guide http://style.tidyverse.org/ is a good place to start. It was written by the author of the popular tidyverse family of packages (dplyr, ggplot, tidyr, and many more) and is used by a wide range of popular packages.

As 2017 this is also the most popular naming convention, according to the useR2017 talk by Rasmus Bååth, author of the paper cited in dwstu 's answer and asker of this question:https://channel9.msdn.com/Events/useR-international-R-User-conferences/useR-International-R-User-2017-Conference/Room-302-Lightning-Talks (starts around 10:30)

answered Jul 15, 2017 at 9:08

Stefan F's user avatar

Stefan FStefan F

2,7332 gold badges18 silver badges19 bronze badges

4