r4ds-exercise-solutions
r4ds-exercise-solutions copied to clipboard
Exercise 3.2.5 requires a minor change to be correct
Based on the Exercise question, the ordinate should be class, hence our code should swap the positions of x and y. One can write
mpg %>% ggplot()+ geom_point(aes(drv,class))
or
ggplot(mpg, aes(x = drv, y = class)) + geom_point()
@mubangansofu Thank you so much for pointing this out. :) Initially, I got confused since in exercise 3.2.5 it says "[..] class vs drv [...]". Thus, the variable "drv" should be plotted on the horizontal bar and the variable "class" on the vertical bar.