-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.Rmd
351 lines (279 loc) · 8.7 KB
/
index.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
---
title: "An interactive ecosystem for learning programming"
author: "Stéphane Guerrier"
date: " "
output:
xaringan::moon_reader:
css: ['default', 'metropolis', 'metropolis-fonts', 'my-css.css']
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
seal: false
self_contained: true
---
```{R, setup, include = F}
# devtools::install_github("dill/emoGG")
library(pacman)
p_load(
broom, tidyverse,
latex2exp, ggplot2, ggthemes, ggforce, viridis, extrafont, gridExtra,
kableExtra, snakecase, janitor,
data.table, dplyr, estimatr,
lubridate, knitr, parallel,
lfe,
here, magrittr
)
# Define pink color
red_pink <- "#e64173"
turquoise <- "#20B2AA"
orange <- "#FFA500"
red <- "#fb6107"
blue <- "#2b59c3"
green <- "#8bb174"
grey_light <- "grey70"
grey_mid <- "grey50"
grey_dark <- "grey20"
purple <- "#6A5ACD"
slate <- "#314f4f"
# Dark slate grey: #314f4f
# Knitr options
opts_chunk$set(
comment = "#>",
fig.align = "center",
fig.height = 7,
fig.width = 10.5,
warning = F,
message = F
)
opts_chunk$set(dev = "svg")
options(device = function(file, width, height) {
svg(tempfile(), width = width, height = height)
})
options(crayon.enabled = F)
options(knitr.table.format = "html")
# A blank theme for ggplot
theme_empty <- theme_bw() + theme(
line = element_blank(),
rect = element_blank(),
strip.text = element_blank(),
axis.text = element_blank(),
plot.title = element_blank(),
axis.title = element_blank(),
plot.margin = structure(c(0, 0, -0.5, -1), unit = "lines", valid.unit = 3L, class = "unit"),
legend.position = "none"
)
theme_simple <- theme_bw() + theme(
line = element_blank(),
panel.grid = element_blank(),
rect = element_blank(),
strip.text = element_blank(),
axis.text.x = element_text(size = 18, family = "STIXGeneral"),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
plot.title = element_blank(),
axis.title = element_blank(),
# plot.margin = structure(c(0, 0, -1, -1), unit = "lines", valid.unit = 3L, class = "unit"),
legend.position = "none"
)
theme_axes_math <- theme_void() + theme(
text = element_text(family = "MathJax_Math"),
axis.title = element_text(size = 22),
axis.title.x = element_text(hjust = .95, margin = margin(0.15, 0, 0, 0, unit = "lines")),
axis.title.y = element_text(vjust = .95, margin = margin(0, 0.15, 0, 0, unit = "lines")),
axis.line = element_line(
color = "grey70",
size = 0.25,
arrow = arrow(angle = 30, length = unit(0.15, "inches")
)),
plot.margin = structure(c(1, 0, 1, 0), unit = "lines", valid.unit = 3L, class = "unit"),
legend.position = "none"
)
theme_axes_serif <- theme_void() + theme(
text = element_text(family = "MathJax_Main"),
axis.title = element_text(size = 22),
axis.title.x = element_text(hjust = .95, margin = margin(0.15, 0, 0, 0, unit = "lines")),
axis.title.y = element_text(vjust = .95, margin = margin(0, 0.15, 0, 0, unit = "lines")),
axis.line = element_line(
color = "grey70",
size = 0.25,
arrow = arrow(angle = 30, length = unit(0.15, "inches")
)),
plot.margin = structure(c(1, 0, 1, 0), unit = "lines", valid.unit = 3L, class = "unit"),
legend.position = "none"
)
theme_axes <- theme_void() + theme(
text = element_text(family = "Fira Sans Book"),
axis.title = element_text(size = 18),
axis.title.x = element_text(hjust = .95, margin = margin(0.15, 0, 0, 0, unit = "lines")),
axis.title.y = element_text(vjust = .95, margin = margin(0, 0.15, 0, 0, unit = "lines")),
axis.line = element_line(
color = grey_light,
size = 0.25,
arrow = arrow(angle = 30, length = unit(0.15, "inches")
)),
plot.margin = structure(c(1, 0, 1, 0), unit = "lines", valid.unit = 3L, class = "unit"),
legend.position = "none"
)
theme_set(theme_gray(base_size = 20))
# Column names for regression results
reg_columns <- c("Term", "Est.", "S.E.", "t stat.", "p-Value")
# Function for formatting p values
format_pvi <- function(pv) {
return(ifelse(
pv < 0.0001,
"<0.0001",
round(pv, 4) %>% format(scientific = F)
))
}
format_pv <- function(pvs) lapply(X = pvs, FUN = format_pvi) %>% unlist()
# Tidy regression results table
tidy_table <- function(x, terms, highlight_row = 1, highlight_color = "black", highlight_bold = T, digits = c(NA, 3, 3, 2, 5), title = NULL) {
x %>%
tidy() %>%
select(1:5) %>%
mutate(
term = terms,
p.value = p.value %>% format_pv()
) %>%
kable(
col.names = reg_columns,
escape = F,
digits = digits,
caption = title
) %>%
kable_styling(font_size = 20) %>%
row_spec(1:nrow(tidy(x)), background = "white") %>%
row_spec(highlight_row, bold = highlight_bold, color = highlight_color)
}
```
```{css, echo = F, eval = F}
@media print {
.has-continuation {
display: block !important;
}
}
```
```{r xaringan-tile-view, echo=FALSE}
xaringanExtra::use_tile_view()
xaringanExtra::use_panelset()
xaringanExtra::use_clipboard()
xaringanExtra::use_extra_styles()
```
class: title-slide
<div class="my-logo-right"></div>
<br>
<br>
<br>
<br>
# Introduction to Data Science
## An interactive system to learn programming
### Stéphane Guerrier, Lionel Voirol and Yuming Zhang
<br>
### 16 December 2021
<br>
```{R, out.width = "25%", echo = F, eval=F}
include_graphics("pics/liscence.png")
```
---
# Teaching Assistants
.pull-left[
```{R, out.width = "90%", echo = F}
include_graphics("pics/ming.png")
```
.center[.hi[Yuming Zhang]]
.center[PhD student in Statistics, GSEM]
]
.pull-right[
```{R, out.width = "90%", echo = F}
include_graphics("pics/lio.png")
```
.center[.hi[Lionel Voirol]]
.center[PhD student in Statistics, GSEM]
]
---
# Course objectives
- This course is intended to provide an .pink[introduction to data science] using the R language.
- Designed for students of the GSEM (often their first programming experience).
- This .pink[programming course] provides the students with notions of data management, manipulation, visualization and analytics (including basic statistical and machine learning methods).
- Other topics such as literate programming, web applications, high performance computing and version control are also discussed.
- At the end of the class, the students realize a group project where they automatically extract data from the web and create an interactive web application to visualize/analyze their data.
---
# Course resources
.pull-left[
.smallest[Website: slides and interactive exercises]
.center[.smallest[[https://intro-to-ds.netlify.app](https://intro-to-ds.netlify.app)]]
```{R, out.width = "90%", echo = F}
include_graphics("pics/web.png")
```
]
.pull-right[
.smallest[Ebook: instructional videos and web apps]
.center[.smallest[[https://smac-group.github.io/ds/](https://smac-group.github.io/ds/)]]
<br>
```{R, out.width = "100%", echo = F}
include_graphics("pics/book.png")
```
]
---
# Website - Lecture slides
.center[![](pics/join.gif)]
---
# Website - Interactive exercises
.center[![](pics/sig3.gif)]
---
# Web applications
<div align="center">
<iframe id="hike_inc"
title="hike_inc"
width="900"
height="440"
src="https://dal-unige.shinyapps.io/rmd_app/">
</iframe>
</div>
.center[.smallest[[https://dal-unige.shinyapps.io/rmd_app/](https://dal-unige.shinyapps.io/rmd_app/)]]
---
# Ebook
```{R, out.width = "90%", echo = F}
include_graphics("pics/function.png")
```
.center[.smallest[[https://smac-group.github.io/ds/](https://smac-group.github.io/ds/)]]
---
# Ebook - Instructional videos
<br>
<div align="center">
<iframe width="700" height="415" src="https://www.youtube.com/embed/0zlWcHDKCFw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
.center[.smallest[Video made by Justin Lee]]
---
# Students' work
Example of homework (automatic customized mass mailing).
<div align="center">
<iframe id="hike_inc"
title="hike_inc"
width="900"
height="440"
src="pics/example_email_knife.html">
</iframe>
</div>
---
# Students' work
```{R, out.width = "80%", echo = F}
include_graphics("pics/hike.png")
```
.center[.smallest[[https://data-analytics-lab.shinyapps.io/hike_inc/](https://data-analytics-lab.shinyapps.io/hike_inc/)]]
---
# Future improvement for 2022
- Develop additional materials on .pink[data analysis and machine learning] aspects of the class.
- Organize (simplified) machine learning competitions for the students (based on the Kaggle framework).
- Find real world projects for the students from local companies (award for the students?).
- ...
.pull-left[
.hi-purple[Thank you very much for your attention!]
.hi-purple[Any questions?]
]
.pull-right[
```{R, out.width = "95%", echo = F}
include_graphics("pics/thanks.png")
```
]