Learn R Through Examples (2020)
Lot&#x27;s of negative comments in here about learning R from experienced programmers. I&#x27;ve found this is largely because experienced programmers have this unjustified bias that R is some toy language that should be easy to learn and has nothing to teach them. If you approached a language like Rust in the same way you would likely be just as frustrated with it.<p>Certainly R has its quirks, but most of this comes from being one of the oldest continuing existing programming languages there is. It derives from S which was written 46 years ago. Because of this it has multiple object&#x2F;class systems reflecting the changing standards for OOP. It&#x27;s most dominant one, S3, predates Java and therefore uses the Generic Function paradigm of OOP similar to Common Lisp&#x27;s ClOS. If you&#x27;re experienced but have never worked with non-Java style OOP you&#x27;re going to be a bit confused.<p>R&#x27;s most important feature, which is well worth studying and mastering for any serious programmer, is that it is a completely vectorized programming language. It borrows this style from APL (though is a million times more readable). Every value in R is a vector and for the vast majority of operations the best approach to solve your problem is by thinking in vector operations. This makes simple things like string formatting with `paste` seem like a confusing nightmare, but there is a real logic there. Functions like `ifelse` can seem strange, and writing C-style code in R, while possible will result in horrible performance.<p>Once you do learn to think in vectors you realize that R isn&#x27;t just popular in the stats world because most statisticians haven&#x27;t seen a &quot;real&quot; programming language, but because you can very rapidly iterate on models. Translating mathematical notation into R, for the experience R programmer, is easier than any other language I&#x27;ve worked with by a long shot.<p>My advice to any experienced programmer approaching R is to have some respect for the language. Most of the frustrations you&#x27;ll have aren&#x27;t because R is a bad language, but because you have less experience than you think and learning R well can expand your programming views in a similar way to Haskell.