Data Science Desktop Survival Guide
by Graham Williams |
|||||
Style Resources |
20200105 There are many style guides available and the guidelines here are generally consistent and overlap considerably with many others. In this chapter I aim to capture the motivation for each choice. My style choices are based on over 30 years of programming in very many different languages. Some elements of style are personal preference and others have very solid foundations. Unfortunately in reading some style guides the choices made are not always explained and without the motivation we do not really have a basis to choose or to debate.
The canonical style guide for the tidyverse is Hadley Wickham's style guide at https://style.tidyverse.org/. Other guidelines can be found at Google and Hadley Wickham's older guide and Colin Gillespie. These are similar though with idiosyncratic differences. Also see Wikipedia for an excellent summary of many styles.
Rasmus Bååth, in The State of Naming Conventions in R, reviews naming conventions used in R, finding that the initial lower case capitalised word scheme for functions was the most popular, and dot separated names for arguments similarly. We are however seeing a migration away from the dot in variable names as it is also used as a class separator for object oriented coding. Using the underscore is now preferred.