-
Notifications
You must be signed in to change notification settings - Fork 5
/
lab-01-hello-r.Rmd
86 lines (52 loc) · 1.62 KB
/
lab-01-hello-r.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
---
title: "Lab 01 - Hello R"
author: "Insert your name here"
date: "Insert date here"
output:
html_document:
fig_height: 4
fig_width: 9
---
## Load packages and data
```{r load-packages, message=FALSE}
library(tidyverse)
library(datasauRus)
```
## Exercises
### Exercise 1
Remove this text, and add your answer for Exercise 1 here.
### Exercise 2
The answers for this exercise are given for you below.
But you should clean up some of the narrative so that it only includes what you want to turn in.
First let's plot the data in the dino dataset:
```{r plot-dino, fig.height=3, fig.width=6}
dino_data <- datasaurus_dozen %>%
filter(dataset == "dino")
ggplot(data = dino_data, mapping = aes(x = x, y = y)) +
geom_point()
```
And next calculate the correlation between `x` and `y` in this dataset:
```{r cor-dino}
dino_data %>%
summarize(r = cor(x, y))
```
### Exercise 3
Add code and narrative as needed.
Note that the R chunks are labeled with `plot-star` and `cor-star` to provide spaces to place the code for plotting and calculating the correlation coefficient.
To finish, clean up the narrative by removing these instructions.
```{r plot-star}
```
I'm some filler text, you should replace me with more meaningful text...
```{r cor-star}
```
### Exercise 4
Add code and narrative as needed.
Note that two R chunks are given but they are not labeled.
Use the convention from above to name them appropriately.
```{r}
```
```{r}
```
### Exercise 5
Add code and narrative as needed.
To add R chunks either type out the backticks, curly braces, and the letter `r` or use the Insert chunk button above, green C+.