01.qmd (3173B)
1 --- 2 engine: knitr 3 title: Introduction 4 --- 5 6 # ️✅ Learning objectives 7 8 ## LOs for the entire book 9 10 - Improve programming skills. 11 - Develop a deep understanding of R language fundamentals. 12 - Understand what functional programming means. 13 - Understand object-oriented programming as applied in R. 14 - Understand metaprogramming while developing in R. 15 - Be able to identify what to optimize and how to optimize it. 16 17 ## LOs for this chapter 18 19 - Recognize the differences between the 1st and 2nd edition of this book. 20 - Describe the overall structure of the book. 21 - Decide whether this book is right for you. 22 23 # What's new? 24 25 ## Hadley's goals 26 27 - Improve coverage of concepts Hadley understood better after 1e 28 - Reduce coverage of unimportant topics 29 - Easier to understand (including many more diagrams) 30 31 ## Base vs rlang 32 33 - [1e](http://adv-r.had.co.nz) used base R almost exclusively 34 - 2e uses {[rlang](https://rlang.r-lib.org/)}, {[purrr](https://purrr.tidyverse.org/)}, etc 35 36 # What we'll learn 37 38 ## The 5 sections 39 40 - **Foundations:** (7 chapters) Building blocks of R 41 - **Functional programming:** (3 chapters) Treating functions as objects (that can be args in functions) 42 - **Object-oriented programming:** (5 chapters + 1) The many object systems of R (we'll add S7) 43 - **Metaprogramming:** (5 chapters) Generating code with code 44 - **Techniques:** (4 chapters) Debugging, measuring performance, improving performance 45 46 ::: notes 47 - Might be useful to open TOC here. 48 ::: 49 50 ## Why R? 51 52 - Diverse & welcoming community 53 - Many packages for stats & modeling, ML, dataviz, data wrangling 54 - Rmarkdown / Quarto 55 - RStudio / Positron 56 - Often used in science 57 - Functional programming powerful for data 58 - Metaprogramming 59 - Ease of connection to C, C++, etc 60 61 ## R imperfections 62 63 - Much code by non-coders (messy) 64 - Community more about results than programming best practices 65 - Metaprogramming can lead to weird failures 66 - Inconsistency from > 30 years of evolution 67 - Poorly written R code runs very poorly 68 69 ## Who should read Advanced R? 70 71 - Intermediate (and up) R programmers who want to really understand R 72 - Programmers from other langs who want to know why R is weird 73 - Prereqs: 74 - You've written lots of code 75 - You understand basics of data analysis 76 - You can install CRAN packages 77 78 ## What this book is not 79 80 - [R for Data Science](https://r4ds.hadley.nz/) 81 - [R Packages](https://r-pkgs.org/) 82 83 ## Meta-techniques 84 85 - Read source code 86 - F2 to see code in RStudio/Positron (with RStudio bindings) 87 - Adopt a scientific mindset 88 - Don't understand something? Hypothesize & experiment 89 90 ## Other books 91 92 - The Structure and Interpretation of Computer Programs (Abelson, Sussman, and Sussman, 1996) [PDF](https://web.mit.edu/6.001/6.037/sicp.pdf) 93 - Concepts, Techniques and Models of Computer Programming (Van Roy & Haridi, 2003) [PDF](https://webperso.info.ucl.ac.be/~pvr/VanRoyHaridi2003-book.pdf) 94 - The Pragmatic Programmer (Hunt & Thomas, 1990) [buy eBook](https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/) 95 96 ::: notes 97 - As far as I can tell, first 2 PDFs are legal. 98 - I don't think a legal, free version of The Pragmatic Programmer is available. 99 :::