snake_case vs Everything_Else

names
news
Author

al

Published

May 7, 2024

Code
knitr::opts_chunk$set(echo=TRUE, message=FALSE, warning=FALSE, dpi=60, out.width = "100%")
options(scipen=999)
options(knitr.kable.NA = '--') #'--'
options(knitr.kable.NAN = '--')

Been preferring snakecase naming convention for all files and columns and variables for a long time for the following reasons:

  1. It’s much easier to type. Reaching for the shift button is a pain.
  2. Arguably easier to read. I find it easier to read snake_case than CamelCase.
  3. Can make it easy to name things in a fashion that allows you to dissect, what, something, is by the way it is named and allows automatic sorting to group similar things together. This presentation by Jenny Bryan is a good read - https://speakerdeck.com/jennybc/how-to-name-files-the-sequel.
Code
knitr::include_graphics("thumbnail.jpg")
Figure 1

Worth noting that sometimes-rules-need-to-be-broken sometimes such as when you are naming chunks in Rmarkdown. It breaks our cross-references.


As we see here though - it doesn’t matter in Quarto (ex. see Figure 1) vs Figure 2).

Code
knitr::include_graphics("all.jpeg")
Figure 2

“no names have an anonymous function”.

    -Michael Sumner