Question: R programming Load ggplot2 and gapminder library. Call ggplot and set the data to gapminder. Assign this line to an object named p. Run print(p).

R programming

  1. Load ggplot2 and gapminder library.
  2. Call ggplot and set the data to gapminder. Assign this line to an object named p.
  3. Run print(p). What happens?
  4. Change your code in part c to include a mapping of gdpPercap column (of gapminder) to the x variable and lifeExp to the y variable. Use print again. What happens now?
  5. What happens if you run p (just type p)?
  6. Add a geom to p to create a scatter plot.
  7. Add a geom_smooth layer to the above plot. What is the effect of this layer? What is the meaning of the shaded area?
  8. Change the method of geom_smooth to a linear model. Is the relationship between life expectancy and gdp per capita linear? Which data is this function using and why?
  9. Change the method for geom_smooth to gam, and transform the x-axis scale from a linear scale to a log scale. Is the scale transformation applied to data before the smoother is layered onto the plot?
  10. Pass the argument labels = scales::dollar to scale_x_log10(). What happens?

Pass the argument labels = scales::comma to scale_x_log10() instead. What happens this time

R programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!