联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-11-01 11:27

HW 5 - ggplot2

MAS 332

Due Monday, 11/2 by Midnight

Instructions

? Please submit your RMD file and knitted document to Blackboard by midnight on Monday, 11/2.

? All data cleaning or prep should be done in a dplyr chain.

? All plots should be created using the ggplot2 package.

Part 1 - Movies and Money

Data prep

The data for this part contains info on the top 50 films by worldwide gross. Please clean/structure the data

in the following format (pay attention to columns and variable types):

'data.frame': 50 obs. of 13 variables:

$ Rank : int 1 2 3 4 5 6 7 8 9 10 ...

$ Title : chr "Avatar" "Titanic" "Star Wars: The Force Awakens" "Jurassic World" ...

$ Worldwide.gross: num 2.79e+09 2.19e+09 2.07e+09 1.67e+09 1.52e+09 ...

$ Year : int 2009 1997 2015 2015 2012 2015 2015 2011 2013 2013 ...

$ Rated : chr "PG-13" "PG-13" "PG-13" "PG-13" ...

$ Released : Date, format: "2009-12-18" "1997-12-19" ...

$ Genre : chr "Action" "Drama" "Action" "Action" ...

$ Director : chr "James Cameron" "James Cameron" "J.J. Abrams" "Colin Trevorrow" ...

$ Awards : chr "Won 3 Oscars. Another 80 wins & 121 nominations." "Won 11 Oscars. Another 110 wins & 73 nominations." "Nominated for 5 Oscars. Another 48 wins & 104 nominations." "6 wins & 53 nominations." ...

$ imdbRating : num 7.9 7.7 8.2 7 8.1 7.2 7.5 8.1 7.6 7.2 ...

$ imdbVotes : int 890617 796903 575439 421709 1003301 280028 467996 546266 424522 560586 ...

$ leadActor : chr "Sam Worthington" "Leonardo DiCaprio" "Harrison Ford" "Chris Pratt" ...

$ OscarWin : chr "Yes" "Yes" "No" "No" ...

1

Plot 1 - Average gross by genre since 2000

The plot below displays the average worldwide gross by genre for movies released in the year 2000 or later.

In addition to the plot, please format the y-axis appropriately. You can format the labels by loading the

scales package, and adding labels=dollar to the appropriate scale function.

$0

$250,000,000

$500,000,000

$750,000,000

$1,000,000,000

$1,250,000,000

Action Adventure Animation

Genre

Average Gross ($)

2

Plot 2 - Gross per film by release year and genre

The scatterplot below displays each films worldwide gross by release year, and is colored by genre. In addition

to constructing the scatterplot, please. . .

? format x- and y-axes appropriately

? choose colors other than the default.

– I chose red3, dodgerblue, gold, and orchid3, but you are welcome to choose any 4 you like

– run colors() to get a list of options

$1,000,000,000

$1,500,000,000

$2,000,000,000

$2,500,000,000

1970 1980 1990 2000 2010

Release Year

Worldwide Gross ($)

Genre

Action

Adventure

Animation

Drama

3

Plot 3 - Faceted Scatterplot

The plot below displays imdb rating by votes for each film, incorporating genre, worldwide gross, and whether

it won an Oscar. In addition to recreating the plot:

? Change the default colors and update the color legend title

? Format the worldwide gross labels as currency, and update the size legend title

? Format the x- and y-axes appropriately

? Set breaks at each integer from 0 to 10 on the rating axis

Animation Drama

Action Adventure

0 500,000 1,000,000 1,500,000 0 500,000 1,000,000 1,500,000

Number of iMDb Votes

iMDb Rating

Worldwide Gross ($)

$1,000,000,000

$1,500,000,000

$2,000,000,000

$2,500,000,000

Oscar Win?

No

Yes

4


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp