Module 9: Visualization in R – Base Graphics, Lattice, and ggplot2
GitHub Repository: AustinTCurtis/r-programming-assignments Choose one dataset from the Rdatasets collection: data("iris", package = "datasets") head(iris) df <- iris Base R Graphics Create at least two plots using base R functions. # Scatterplot: species_cols <- c(setosa = "steelblue", versicolor = "orange", virginica = "forestgreen") plot(df$Sepal.Length, df$Sepal.Width, main = "Base: Sepal.Width vs Sepal.Length", xlab = "Sepal Length", ylab = "Sepal Width", col = species_cols[df$Species], pch = 19) legend("topright", legend = levels(df$Species), col = species_cols, pch = 19, bty = "n") # Histogram: hist(df$Petal.Length, main = "Base: Distribution of Petal Length", xlab = "Petal Length") Lattice Graphics Use the lattice package to produce conditioned or multivariate plots. # Lattice Graphics library(lattice) # Conditional scatt...