library(tidyverse)
library(datasauRus)
This data frame has 1846 rows and 3 columms. variables included in the data fram are appreances.
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
-0.0645
-0.0630
star_data <- datasaurus_dozen %>%
filter(dataset == "star")
ggplot(data = star_data, mapping = aes(x = x, y = y)) +
geom_point()
star_data %>%
summarize(r = cor(x, y))
## # A tibble: 1 × 1
## r
## <dbl>
## 1 -0.0630
Some more narrative can go here.
# Calculate the correlation here
Conclude with some more narrative, if needed.
ggplot(datasaurus_dozen, aes(x = x, y = y, color = dataset))+
geom_point()+
facet_wrap(~ dataset, ncol = 3) +
theme(legend.position = "none")
datasaurus_dozen %>%
group_by(dataset) %>%
summarize(r = cor(x, y))
## # A tibble: 13 × 2
## dataset r
## <chr> <dbl>
## 1 away -0.0641
## 2 bullseye -0.0686
## 3 circle -0.0683
## 4 dino -0.0645
## 5 dots -0.0603
## 6 h_lines -0.0617
## 7 high_lines -0.0685
## 8 slant_down -0.0690
## 9 slant_up -0.0686
## 10 star -0.0630
## 11 v_lines -0.0694
## 12 wide_lines -0.0666
## 13 x_shape -0.0656
The plots visualized the shape of each labeled.
dino_data <- datasaurus_dozen %>%
filter(dataset == "dino")
ggplot(data = dino_data, mapping = aes(x = x, y = y)) +
geom_point()
star_data <- datasaurus_dozen %>%
filter(dataset == "star")
ggplot(data = star_data, mapping = aes(x = x, y = y)) +
geom_point()
ggplot(datasaurus_dozen, aes(x = x, y = y, color = dataset))+
geom_point()+
facet_wrap(~ dataset, ncol = 3) +
theme(legend.position = "none")