The tidyverse style guide

All style guides are fundamentally opinionated. Some decisions genuinely do make code easier to use (especially matching indenting to programming structure), but many decisions are arbitrary. The most important thing about a style guide is that it provides consistency, making code easier to write because you need to make fewer decisions.”

-Hadley Wickham, “The tidyverse style guide.” style.tidyverse.org

Probably the definitive guide for writing R code. See also Hadley Wickham’s Advanced R.