Variable names with "_" instead of "."

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...)?


The tidyverse style guide should hold your answers…


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.

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:

1 Like