I self-learned R in a really poor way and I’m trying to improve. I’ve read Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin (2009), which provides best practices for coding and I found it helpful. However, my capacity to understand it was limited because I have no programming experience besides R so couldn’t understand the jargon (or much of the examples, written in Java). My question is:
If I found other books that provide foundational best practices like Clean Code does that are written specifically for/with R, it would really help. I use R for data science and I never get very far into a project without creating a total rat's nest; in particular, I struggle with writing concise code, and in knowing when I should start a new script, and how to get separate scripts to work together coherently.
I have also read Good Enough Practices for Scientific Computing by Wilson et al. (2017), which is great. I do use R projects. Thank you for your time!
R is a multi-paradigm language, so directly adapting OOL-like code style to improve your R skills isn't exactly the best idea. 16 of the usual GoF design patterns are irrelevant or trivial in FP (hence also in R) - it would be more than counterproductive to limit yourself with the OO mindset.
I do recommend reading "Clean Code" (the cosmetics of OO code isn't much different than what FP programmers would consider "clean"), but to really optimize your R code you need a supplement of FP. In that case, plenty of books are available for you to read: Michelson's "An Introduction to Functional Programming Through Lambda Calculus" (if you are completely new to FP), "Functional Thinking" by Neal Ford, "Becoming Functional" by Joshua Backfield.
FP is pure untapped power which you can use in R. Why limit yourself only with OOP?