Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey how can I make two average vertical lines in the graphs and use annotate() to label them? + can you check if my r

Hey how can I make two average vertical lines in the graphs and use annotate() to label them? + can you check if my r code is right so far?

Thanks

image text in transcribed

\#\# Question 1 [1 point] low points, on average, did the Boston Celtics score at home and away games in the 2017 season? Calculate this answer and also plot the multivariate relationship. Explain why your chosen visualization is justified. EC: Draw two vertical lines for the average points at home and away and label them with the average points using 'annotate (geom= 'text',) '. games %>% filter(yearSeason == '2017', nameTeam == 'Boston Celtics') %% \# Filter to the 2017 season (yearSeason) AND to the Boston Celtics (nameTeam) group_by(locationGame) \%>\% \# Group by the location of the game (locatoinGame) summarise(mean_pts=mean(pts)) \#Calculate the average points (pts) games %>% filter(yearSeason == '2017', nameTeam == 'Boston Celtics') \% \% \# Filter to the 2017 season (yearSeason) AND to the Boston Celtics (nameTeam) ggplot (aes(x= pts, fill = locationGame )) + \# Create a multivariate plot comparing points scored between home and away games geom_density(alpha=0.3) + \# Choose the appropriate geom_... for this plot (i.e., geom_histogram(), geom_density(), geom_bar(), etc.) labs(title = "Points Scored by the Boston Celtics in 2017", subtitle = "Comparing Home and Away Games", x= "Location of Game", y= "Points Scored") + \# Add clear descriptions for the title, subtitle, axes, and legend geom_vline(xintercept =109.5, color = "blue", linetype = "dashed") + \# EC: add vertical lines for the average points scored at home and away. annotate()

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_2

Step: 3

blur-text-image_3

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Do you have sufficiently ambitious milestones?

Answered: 1 week ago

Question

LO5 Illustrate the steps in developing a base pay system.

Answered: 1 week ago

Question

LO3 Outline strategic compensation decisions.

Answered: 1 week ago