ggplot2
ggplot2 builds charts by layers: data, aesthetics with aes(), then geoms such as geom_point and geom_bar. Add labs and themes to polish.
Example
library(ggplot2)
df <- data.frame(x = 1:4, y = c(2, 4, 3, 6))
ggplot(df, aes(x, y)) + geom_line() + geom_point() + labs(title = "Scores")Exercise
Add a layer with.
ggplot(df, aes(x, y)) geom_point()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.