Assignment R Solutions
Assignment R Solutions
# Exercise 1
```
```{r}
# Exercise 2
```
```{r}
# Exercise 3
# (b) Scatter plot representing PC1 vs. PC2 with data clusters marked
# Combine PC scores with species
pc_scores$Species <- iris$Species
# Plotting
ggplot(pc_scores, aes(x = PC1, y = PC2, color = Species)) +
geom_point() +
labs(x = "PC1", y = "PC2") +
theme_minimal()
```
```{r}
# Exercise 4
qqnorm(Animals$brain)
qqline(Animals$brain)
qqnorm(Animals$body)
qqline(Animals$body)
qqnorm(transformed_brain)
qqline(transformed_brain)
```