Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions