Variable names with "_" instead of "."


#1

Hey all,

(I apologize if this question is asked elsewhere -- I just had a lot of trouble searching for it, since its not about words :P)

Anyway, I have noticed that, in the tidyverse, people seem to prefer "_" rather than "." to separate words that need to be joined together (e.g. read_csv > read.csv), in contrast to old-R formats. Is there anywhere that describes why the tidyverse prefers it this way?

Additionally/relatedly, does this preference extend to anything that might have the choice (e.g. is it the same whether it is a function, object name, column in a nibble, etc...)?

Thanks!


#2

The tidyverse style guide should hold your answers…
http://style.tidyverse.org/syntax.html#object-names


#3

Thanks -- I knew I had seen it somewhere...

It seems as if it's most important for functions (due to the S3 objects/class issue), but probably just as well to do it elsewhere too.


#4

Just to be clear: it's not so much important as it is a matter of convention inside of the tidyverse. It's something along the lines of "when in doubt, be consistent." :slightly_smiling_face: