Load packages
library(tidyverse)
library(datasauRus)
Exercise 1
- datasaurus_dozen has 1846 rows, 3 column
- 3 variables: dataset, x, y
Exercise 2
dino_data <- datasaurus_dozen %>%
filter(dataset == "dino")
ggplot(data = dino_data, mapping = aes(x = x, y = y)) +
geom_point()

dino_data %>%
summarize(r = cor(x, y))
## # A tibble: 1 × 1
## r
## <dbl>
## 1 -0.0645
Exercise 3
star_data <- datasaurus_dozen %>%
filter(dataset =="star")
ggplot(data = star_data, mapping = aes(x=x, y=y))+ geom_point()

The plot look like a star ^^
star_data %>%
summarise(r = cor(x,y))
## # A tibble: 1 × 1
## r
## <dbl>
## 1 -0.0630
Exercise 4
circle_data <- datasaurus_dozen %>%
filter(dataset =="circle")
ggplot(data = circle_data, mapping = aes(x=x, y=y))+ geom_point()

The plot look like a eclipse ^^
circle_data %>%
summarise(r = cor(x,y))
## # A tibble: 1 × 1
## r
## <dbl>
## 1 -0.0683
Exercise 5
ggplot(datasaurus_dozen, aes(x = x, y = y, color = dataset))+ geom_point() + facet_wrap(~dataset, ncol = 3) + theme(legend.position = "none")
