<- 10
my_variable my_varıable
2 Exercises (Chapter 2)
Why does this code not work?
Look carefully! (This may seem like an exercise in pointlessness, but training your brain to notice even the tiniest difference will pay off when programming.)
Tweak each of the following R commands so that they run correctly:
libary(todyverse) ggplot(dTA = mpg) + geom_point(maping = aes(x = displ y = hwy)) + geom_smooth(method = "lm)
Press Option + Shift + K / Alt + Shift + K. What happens? How can you get to the same place using the menus?
Let’s revisit an exercise from “Saving Your Plots”. Run the following lines of code. Which of the two plots is saved as
mpg-plot.png
? Why?<- ggplot(mpg, aes(x = class)) + my_bar_plot geom_bar() <- ggplot(mpg, aes(x = cty, y = hwy)) + my_scatter_plot geom_point() ggsave(filename = "mpg-plot.png", plot = my_bar_plot)