Answered step by step
Verified Expert Solution
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
- Load ggplot2 and gapminder library.
- Call ggplot and set the data to gapminder. Assign this line to an object named p.
- Run print(p). What happens?
- 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?
- What happens if you run p (just type p)?
- Add a geom to p to create a scatter plot.
- Add a geom_smooth layer to the above plot. What is the effect of this layer? What is the meaning of the shaded area?
- 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?
- 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?
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started