This post is about ggplot2 and dplyr packages, so let’s start with loading them:
library(ggplot2) library(dplyr) I can’t be the first person to make the following mistake:
ggplot(mtcars, aes(x = wt, y = mpg)) %>% geom_point() Can you spot the mistake in the code above? Look closely at the end of the first line.
The operator should be the + used in ggplot2 for layering, not the %>% operator used in dplyr for piping, like this:
Continue reading