-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathchapter2.Rmd
540 lines (402 loc) · 14.7 KB
/
chapter2.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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
---
title: 'Lab 2 - Introduction to data'
description: 'Questions for Lab 2'
---
## Question 1
```yaml
type: ExplorableExercise
key: 02d4222b54
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file:</strong>
```Type 'go()' and hit Enter to get started!```
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q1. How many flights are in this `sfo_feb_flights`?</strong>
`@possible_answers`
- 68
- 1345
- 2286
- 3563
- 32735
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 1)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex1.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex1.init.R
# lab2_ex1.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex1.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Great work!"
msg2 <- "Try again."
msg3 <- "Keep trying!"
msg4 <- "Nope."
msg5 <- "Not quite."
ex() %>% check_mc(1, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 2
```yaml
type: ExplorableExercise
key: 5440b387f2
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q2. Which of the following is false?</strong>
`@possible_answers`
- The distribution is unimodal.
- The distribution is right skewed.
- No flight is delayed more than 2 hours.
- The distribution has several extreme values on the right side.
- More than 50% of flights arrive on time or earlier than scheduled.
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 2)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex2.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex2.init.R
# lab2_ex2.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex2.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Not quite."
msg2 <- "Keep trying!"
msg3 <- "Nice job!"
msg4 <- "Nope!"
msg5 <- "Try again!"
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 3
```yaml
type: ExplorableExercise
key: eb6689ed9c
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q3. Which carrier has the highests IQR of arrival delays?</strong>
`@possible_answers`
- American Airlines
- JetBlue Airways
- Virgin America
- Delta and United Airlines
- Frontier Airlines
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 3)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex3.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex3.init.R
# lab2_ex3.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex3.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
# rdu_flights.RData: https://assets.datacamp.com/production/course_1156/datasets/rdu_flights.RData
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Awesome!"
msg3 <- "Keep trying!"
msg4 <- "Great! That's right."
msg5 <- "Try again."
ex() %>% check_mc(4, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 4
```yaml
type: ExplorableExercise
key: e64497e7f4
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q4. Which month has the highest AVERAGE departure delay from an NYC airport?</strong>
`@possible_answers`
- January
- March
- July
- October
- December
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 4)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex4.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex4.init.R
# lab2_ex4.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex4.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Keep trying!"
msg3 <- "You got it!"
msg4 <- "Try again."
msg5 <- "Try again."
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 5
```yaml
type: ExplorableExercise
key: b073c8a4d3
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q5. Which month has the highest MEDIAN departure delay from an NYC airport?</strong>
`@possible_answers`
- January
- March
- July
- October
- December
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 5)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex5.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex5.init.R
# lab2_ex5.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex5.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Not quite."
msg3 <- "Keep trying!"
msg4 <- "Try again."
msg5 <- "You are correct!"
ex() %>% check_mc(5, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 6
```yaml
type: ExplorableExercise
key: 8aee5ae535
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q6. Is the mean or the median a more reliable measure for deciding which month(s) to avoid flying if you really dislike delayed flights, and why?</strong>
`@possible_answers`
- Mean would be more reliable as it gives us the true average.
- Mean would be more reliable as the distribution of delays is symmetric.
- Median would be more reliable as the distribution of delays is skewed.
- Median would be more reliable as the distribution of delays is symmetric.
- Both give us useful information.
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 6)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex6.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex6.init.R
# lab2_ex6.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex6.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Keep trying!"
msg2 <- "Try again."
msg3 <- "Great work!"
msg4 <- "Try again."
msg5 <- "Nope, try again."
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 7
```yaml
type: ExplorableExercise
key: 63abfd6950
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q7. If you were selecting an airport simply based on on time departure percentage, which NYC airport would you choose to fly out of?</strong>
`@possible_answers`
- EWR
- JFK
- LGA
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 7)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex7.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex7.init.R
# lab2_ex7.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex7.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Keep trying!"
msg3 <- "Awesome, you did great!"
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3))
```
---
## Question 8
```yaml
type: ExplorableExercise
key: ca476ff87f
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q8. What is the tail number of the plane with the fastest `avg_speed`?</strong>
`@possible_answers`
- N666DN
- N755US
- N779JB
- N947UW
- N959UW
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 8)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex8.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex8.init.R
# lab2_ex8.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex8.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Well done!"
msg2 <- "Try again."
msg3 <- "Keep trying!"
msg4 <- "Try again."
msg5 <- "Nope, not quite"
ex() %>% check_mc(1, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 9
```yaml
type: ExplorableExercise
key: 4099fadc1b
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q9. Which of the following is true about the relationship between average speed and distance?</strong>
`@possible_answers`
- As distance increases the average speed of flights decreases.
- The relationship is linear.
- There is an overall postive association between distance and average speed.
- There are no outliers.
- The distribution of distances are uniform over 0 to 5000 miles.
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 9)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex9.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex9.init.R
# lab2_ex9.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex9.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Try again."
msg3 <- "Great work!"
msg4 <- "Try again."
msg5 <- "Keep trying!"
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
```
---
## Question 10
```yaml
type: ExplorableExercise
key: caf40f340b
xp: 50
skills: 1
```
<strong>Follow the directions in the console to open the R Markdown file.</strong>
You can use the RStudio platform just like you would on your home computer.
The markdown file contains the instuctions to answer the multiple choice question below.
<strong>Q10. Determine the on time arrival percentage based on whether the flight departed on time or not. What percent of flights that were "delayed" departing arrive "on time"?</strong>
`@possible_answers`
- Number 1 - 0.15
- Number 2 - 0.17
- Number 3 - 0.18
- Number 4 - 0.20
- Number 5 - 0.21
`@hint`
Check out the instructions in the .Rmd file to answer the multiple choice question.
`@pre_exercise_code`
```{r}
# Import the helper file contained in the image
source('/usr/local/lib/R/site-library/run_rstudio.R')
# Run a new RStudio session and serve it to the user
run_rstudio(2, 10)
# .Rprofile: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex10.Rprofile
# .init.R: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex10.init.R
# lab2_ex10.Rmd: https://assets.datacamp.com/production/course_1156/datasets/lab2_ex10.Rmd
# lab.css: https://assets.datacamp.com/production/course_1156/datasets/lab.css
```
`@sct`
```{r,eval=FALSE}
msg1 <- "Try again."
msg2 <- "Try again."
msg3 <- "Awesome!"
msg4 <- "Try again."
msg5 <- "Keep trying!"
ex() %>% check_mc(3, feedback_msgs = c(msg1, msg2, msg3, msg4, msg5))
success_msg("Click [here](https://assets.datacamp.com/production/repositories/302/datasets/1b666c3c765d89a092e0e0ce8899f380cac0f96c/ch2_key.Rmd) to get a complete Rmarkdown file of the exercises in this Lab and click [here](https://assets.datacamp.com/production/repositories/302/datasets/43e95196b97c019a619b7ec8386257659bafe766/ch2_key.html) to get the Knitted HTML output.")
```