generated from r4ds/bookclub-template
-
Notifications
You must be signed in to change notification settings - Fork 25
/
01_Introduction.Rmd
239 lines (178 loc) · 7.45 KB
/
01_Introduction.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Introduction
**Learning objectives:**
**For the entire book:**
- Improve programming skills.
- Develop a deep understanding of the R language fundamentals.
- Understand what functional programming means.
- Understand object-oriented programming as applied in R.
- Understand metaprogramming while developing in R.
**For this chapter (includes the Welcome and Preface):**
- Recognize the differences between the 1st and 2nd edition of this book.
- Describe the overall structure of the book.
- Decide whether this book is right for you.
Books suggestions:
- [The Structure and Interpretation of Computer Programs (SICP)](https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book.html)
- [Concepts, Techniques and Models of Computer Programming](https://mitpress.mit.edu/books/concepts-techniques-and-models-computer-programming)
- [The Pragmatic Programmer](https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/)
## What's new?
> "The [first edition](http://adv-r.had.co.nz) used base R functions almost exclusively, this version of the book expands into more advanced functions provided by other pakages."
> "Use of new packages, particularly rlang, which provides a clean interface to low-level data structures and operations."
```{r, echo=FALSE,out.width="49%",out.height="49%",fig.show='hold',fig.align='center', fig.cap="Twitter: `@hadleywickham` - 6 June 2019"}
knitr::include_graphics(c("images/01-hadley-image1.jpeg","images/01-hadley-image2.jpeg"))
```
## Overview of the book structure
* The book is composed of five sections. A step by step path towards mastering R techniques.
* The **Foundations** is the part in which the R components will be examined. It will help understanding how to use all the basics tools to deal with functions and structures.
* The **Functional programming** goes a little more in dept into programming with R, making functions of functions. Describing function factories and operators.
* The **Object-oriented programming** - OOP is a five chapter section, all about object oriented systems among S3, R6 and S4.
* The **Metaprogramming** section introduces you through the programming layers.
* Finally, the **Techniques** section is dedicated to finding and fixing bugs and improving performances.
### What this book is not
* This book is about the R programming language, not R as the data analysis tool.
* Other books cover this topic.
* [R for Data Science](https://r4ds.had.co.nz/).
* We will not be discussing package development at length.
* [R Packages](https://r-pkgs.org/).
* Some experience using R will be helpful.
* I encourage all to participate, though.
### Organization of the book
```{r dia-lib,include=FALSE}
library(DiagrammeR)
```
<center>
```{r c00, echo=FALSE, fig.align='center', fig.dim="100%"}
DiagrammeR("
graph TD
A{Foundations}-->B(Functional programming)
B-->C(Object-oriented programming)
C-->D(Metaprogramming)
D-->E(Techniques)
")
```
</center>
### Foundations
Six chapters to learn the foundational components of R.
<center>
```{r c01, echo=FALSE, fig.align='center', fig.dim="100%"}
DiagrammeR("
graph TD
A{Foundations}-->B(Names and values)
A-->C(Control flow)
C-->E(Functions)
B-->D(Vectors)
D-->F(Subsetting)
E-->G(Environment)
G-->H(Conditions)
F-->H
")
```
</center>
The last chapter "conditions" describe errors, warnings, and messages.
### Functional programming
This part of the book is dedicated to functions: function factories and operators.
<center>
```{r c02,echo=FALSE,fig.align='center',fig.dim="100%"}
DiagrammeR("
graph TD
A{Functional programming}-->B(Functionals)
B-->C(Function factories)
B-->E(Function operators)
")
```
</center>
### Object-oriented programming
OOP is the most dense part of the book, as it mentions about systems which interact with R.
<center>
```{r c03,echo=FALSE,fig.align='center',fig.dim="100%"}
DiagrammeR("
graph TD
A{Object-oriented programming}-->B(Base types)
B-->C(S3)
B-->E(R6)
B-->D(S4)
D-->F(Trade-offs)
E-->F
C-->F
")
```
</center>
### Metaprogramming
This is the part of the book where things are blended to the **Big Picture**. R is a versatile functional language that can be managed and assembled.
<center>
```{r c04,echo=FALSE,fig.align='center',fig.dim="100%"}
DiagrammeR("
graph TD
A{Metaprogramming}-->B(Big Picture)
B-->C(Expressions)
B-->E(Quasiquotation)
B-->D(Evaluation)
D-->F(Translating R code)
E-->F
C-->F
")
```
</center>
### Techniques
Finally, this is the last section of the book, where debugging is used to measure and improve performance. And how to improve performance by rewriting key functions in C++.
<center>
```{r c05,echo=FALSE,fig.align='center',fig.dim="100%"}
DiagrammeR("
graph TD
A{Techniques}-->B(Debugging)
B-->C(Measuring performance)
B-->E(Improving performance)
C-->D(Rewriting R code in C++)
E-->D
")
```
</center>
## Resources
- [first edition](http://adv-r.had.co.nz)
- [advanced-r-solutions](https://advanced-r-solutions.rbind.io/)
## Meeting Videos
### Cohort 1
(no video recorded)
### Cohort 2
`r knitr::include_url("https://www.youtube.com/embed/PCG52lU_YlA")`
### Cohort 3
`r knitr::include_url("https://www.youtube.com/embed/f6PuOnuZWBc")`
### Cohort 4
`r knitr::include_url("https://www.youtube.com/embed/qDaJvX-Mpls")`
### Cohort 5
`r knitr::include_url("https://www.youtube.com/embed/BvmiQlWOP5o")`
### Cohort 6
`r knitr::include_url("https://www.youtube.com/embed/dH72riiXrVI")`
<details>
<summary> Meeting chat log </summary>
```
00:14:40 SriRam: From Toronto, Civil Engineer. I use R for infrastructure planning/ GIS. Here coz of the ping 😄 , was not ready with a good computer with mic/audio !
00:15:20 SriRam: I was with Ryan, Federica on other courses
00:23:21 SriRam: I think the only caution is about Copyright issues
00:31:32 Ryan Metcalf: Citation, giving credit back to source. Great comment SriRam.
00:34:33 SriRam: one = one, in my opinion
00:41:53 Ryan Metcalf: https://docs.google.com/spreadsheets/d/1_WFY82UxAdvP4GUdZ2luh15quwdO1n0Km3Q0tfYuqvc/edit#gid=0
00:48:35 Arthur Shaw: The README has a nice step-by-step process at the bottom: https://github.com/r4ds/bookclub-advr#how-to-present. I've not done this myself yet, but it looks fairly straightforward.
00:54:13 lucus w: Thanks Ryan. Probably {usethis} will be easier. It looks straight forward
01:00:02 Moria W.: Thank you for sharing that. This has been good!
01:00:08 Vaibhav Janve: Thank you
01:00:44 Federica Gazzelloni: hi SriRam we are going..
```
</details>
### Cohort 7
`r knitr::include_url("https://www.youtube.com/embed/vfTg6upHvO4")`
`r knitr::include_url("https://www.youtube.com/embed/3wRyE6-3OKQ")`
<details>
<summary>Meeting chat log</summary>
```
00:20:42 collinberke: https://rich-iannone.github.io/pointblank/
00:27:36 Ryan Honomichl: brb
00:37:05 collinberke: https://rstudio.github.io/renv/articles/renv.html
00:51:52 Ryan Honomichl: gotta sign off I'll be ready to lead chapter 2 next week!
00:52:43 collinberke: https://r4ds.had.co.nz/iteration.html
00:59:44 collinberke: https://mastering-shiny.org/action-tidy.html
01:00:12 collinberke: https://dplyr.tidyverse.org/articles/programming.html
01:05:02 collinberke: https://usethis.r-lib.org/reference/create_from_github.html
01:05:53 collinberke: https://github.com/r4ds/bookclub-advr
01:06:28 Ron: I gotta run , fun conversation, and nice to meet you Matthew !
```
</details>