[SOLVED] 代写 R game Java javascript theory You need to have JavaScript enabled in order to access this site.

30 $

File Name: 代写_R_game_Java_javascript_theory_You_need_to_have_JavaScript_enabled_in_order_to_access_this_site..zip
File Size: 960.84 KB

SKU: 1359910319 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


You need to have JavaScript enabled in order to access this site.

Skip To Content
Dashboard
• 

Account
•
Dashboard
•
Courses
•
Groups
•
Calendar
•
Inbox
•
Help

Close
•My Dashboard
•COMM 205 101 102 103
•Quizzes
•Part B – Assignment 4 (R and RStudio)

2019W1
•Home
•Announcements
•Modules
•Discussions
•iClicker
•Quizzes
•Assignments
•Grades
•Course Evaluation
•Piazza
Part B – Assignment 4 (R and RStudio)
Started: Nov 30 at 9:47am
Quiz Instructions

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
CASE 1: USE THIS CASE TO ANSWER QUESTIONS 1 THROUGH 4
Suppose that you have the following two datasets covering movies and actors (representative screenshots were provided below). Note that “actors” will refer both to actors and actresses. You are not provided with the datasets in this case. Please use the description provided below to answer the questions.
Movies data frame
There are exactly 17,454 observations in this data frame, covering all movies released in the US from 1980 to 2014. The unique identifiers for each observation are title and year. This dataset contains the following variables (i.e., columns):
title: Movie title (character)
year: Year of release (numerical)
length: Length, in minutes (numerical)
director_l: Last name of director (character)
director_f: First name of director (character)
director_ID: A unique 8-digit number for each director (numerical)
budget: Budget, in dollars (numerical)
revenue: U.S. Box Office revenue, in dollars (numerical)
best_picture: Equals 1 if the movie won the Academy Award for Best Picture, and 0 otherwise (numerical)

Actors
This data frame contains more than 100,000 observations, covering all actors that had “above the line” roles in Movies data frame. Above the line credits are the names that appear one by one on the screen during the opening (or sometimes closing) credits for a film. The unique identifiers for each observation are actor_ID, title, and year. Hence, it is possible that the same actor appears multiple times in this dataset because actor_ID by itself is not the unique identifier of this dataset. All observations in Actors data frame can be matched to Movies data frame. This dataset contains the following variables (i.e., columns):
actor_ID: A unique 8-digit number for each actor (numerical)
actor_l: Last name of actor (character)
actor_f: First name of actor (character)
title: Title of movie that actor appeared in (character)
year: Year that movie was released (numerical)
best_actor: Equals 1 if received the Academy Award for Best Actor for that film, and 0 otherwise (numerical)
best_actress: Equals 1 if received the Academy Award for Best Actress for that film, and 0 otherwise (numerical)

Assume that these two data frames (Movies and Actors) are in your active R session. Assume there are NO missing values for ANY observations in either dataset.

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 1 8 pts
Suppose you want to identify how many movies in our entire Movies data frame each director (by director_ID) has directed. You do not want to create a new data frame with the result. You just want to display the result. Remember that tidyverse library has been already loaded.
Complete the following code that will accomplish the above objective.
Movies %>%
group_by (director_ID) %>%
summarise (number_of_movies = n )

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 2 10 pts
Suppose you want to identify those actors/actresses who have appeared only in movies that lost money (where the revenue is less than the budget). In other words, all the movies that an actor/actress starred in must be loss-generating movies (i.e., revenue < budget) to be included in the result. If there is even just one movie that made profit or was on a break-even point (i.e., revenue >= budget) among all the movies an actor/actress played, that actor/actress should not be included in the result.
Along with the actor_ID, you want your final data frame to display the title and year of each movie he/she appeared, amount of money lost in the movie (actual_money_lost, where it is defined as budget-revenue). Assume that Actors and  Movies are in your active R session and tidyverse was loaded.
Complete the following code that will accomplish the above objectives. Note that for each blank, you can use the name of an appropriate function or the name of an appropriate variable (i.e., a column name).
Movies2 <- Movies %>%
mutate(lost_money = if_else (revenue < budget, 1, 0))combined <- select (Actors, Movies2)results <- combined %>%
( ) %>%
(at_least_one = ( )) %>%
(at_least_one == 1) %>%
mutate (actual_money_lost = budget – revenue) %>%
select(actor_ID, title, year, actual_money_lost)

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 3 8 pts
In 1994, a parlour game called “Six Degrees of Kevin Bacon” took off. It requires players to link celebrities to Kevin Bacon in as few steps as possible. Kevin Bacon has appeared in more than 70 movies of varying genres across many years—such as Footloose and Apollo 13—and so, the theory is that he is, quite possibly, at the center of the entertainment universe. If you search an actor’s name in Google followed by “Bacon number” you will get the degrees of separation to get to Kevin Bacon.
Kevin Bacon himself has a Bacon number of 0.
Brad Pitt has a Bacon number of 1, since they both appeared in the 1996 film Sleepers.
Will Smith’s Bacon number is 2. Will Smith has not appeared in a movie with Kevin Bacon. However, Will Smith and Zoë Kravitz appeared in After Earth. Zoë Kravitz and Kevin Bacon appeared in X-Men: First Class.
Incidentally, although he doesn’t appear in Actors, President Barack Obama has a Bacon number of 2. President Obama appeared in the documentary The Road We’ve Traveled with Tom Hanks. Tom Hanks and Kevin Bacon appeared in Apollo 13.
You have decided to create a Bacon number for all actors in the Actors data frame.
As a first step, you want to create a new variable, called bacon. The variable bacon should be equal to 1 if actor_ID is equal to 10000001 (Kevin Bacon’s actor_ID), and 0 otherwise. Below are a series of commands that has been started for you.
Complete the following R code that will allow you to achieve this objective: That is, you will create a new variable bacon, which is equal to 1 if actor_ID is equal to 10000001 (Kevin Bacon’s actor ID), and 0 otherwise. Assume you have Actors data frame in your active R session and tidyverse is already loaded.
Actors <- Actors %>%
mutate (bacon =   if_else ( actor_ID =  10000001, 1 , 0)

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 4 10 pts
Assume that you have created the variable bacon correctly (from the previous question). You want to create a variable, called bacon_number, which is equal to 1 for all actors that have ever appeared in a movie with Kevin Bacon in Actors data frame. You want bacon_number to be equal to 0 for Kevin Bacon, and you want it to be equal to NA for any other observations.
For example, Tom Cruise appeared with Kevin Bacon in the 1992 movie A Few Good Men, making Tom Cruise’s Bacon Number equal to 1. We want bacon_number to be equal to 1 for all observations for Tom Cruise, even in movies where he did not appear together with Kevin Bacon. For example, we would want to make sure that Tom Cruise’s bacon_number is still equal to 1 when he appears in Rain Man in 1988 or Edge of Tomorrow in 2014.
Recall the assumption that you have created the variable bacon successfully before. The following sequence of commands comes right after the previous question. That is, in your Actors data frame you have the 7th column called bacon and it is equal to 1 for every observations of Kevin Bacon and 0 otherwise. Also, recall that Kevin Bacon’s actor_ID is 10000001.
Which of the following series of commands will achieve the above task?
There is AT LEAST ONE correct option, but you MUST SELECT ALL correct option(s). There is no partial credit.
Note that if you put a negative sign (i.e., -) in front of a column name you specified in select(), it means that you want to select all the columns except the one indicated with a negative sign. For example, Actors %>% select(-best_actor) is identical to Actors %>% select( actor_ID, actor_l, actor_f, title, year, best_actress).
Group of answer choices
bacon_temp <- Actors %>% group_by(title, year) %>% summarize(bacon_number_temp = max(bacon))
data_temp  <- left_join(Actors, bacon_temp)data_temp2 <- data_temp %>% group_by(actor_ID) %>% summarize(bacon_number = max(bacon_number_temp))
Actors <- left_join(data_temp, data_temp2)Actors$bacon_number[Actors$bacon_number == 0] <- NAActors$bacon_number[Actors$actor_ID == 10000001] <- 0Actors <- Actors %>% select(-bacon_number_temp)
bacon_temp <- Actors %>% group_by(title, year) %>% mutate(bacon_number_temp = max(bacon))
data_temp  <- left_join(Actors, bacon_temp)data_temp2 <- data_temp %>% group_by(actor_ID) %>% mutate(bacon_number = max(bacon_number_temp))
Actors <- left_join(data_temp, data_temp2)Actors$bacon_number[Actors$bacon_number == 0] <- NAActors$bacon_number[Actors$actor_ID == 10000001] <- 0Actors <- Actors %>% select(-bacon_number_temp)
Actors <- Actors %>% group_by(title, year) %>% summarize(bacon_number_temp = max(bacon))
Actors <- Actors %>% group_by(actor_ID) %>% summarize(bacon_number = max(bacon_number_temp))
Actors$bacon_number[Actors$bacon_number == 0] <- NAActors$bacon_number[Actors$actor_ID == 10000001] <- 0Actors <- Actors %>% select(-bacon_number_temp)
Actors <- Actors %>% group_by(title, year) %>% mutate(bacon_number_temp = max(bacon))
Actors <- Actors %>% group_by(actor_ID) %>% mutate(bacon_number = max(bacon_number_temp))
Actors$bacon_number[Actors$bacon_number == 0] <- NAActors$bacon_number[Actors$actor_ID == 10000001] <- 0Actors <- Actors %>% select(-bacon_number_temp)
All of the options are incorrect.

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
CASE 2: USE THIS CASE AND THE DATASET (mobile.rds) TO ANSWER QUESTIONS 5 THROUGH 8
The dataset contains data on a select number of mobile apps. Many apps request permissions to access user data or device data. The dataset in mobile.rds list each of the permissions requested by a set of apps.
You need to download mobile.rds and use to answer Questions 5, 6, 7, and 8 of this assignment.
mobile.rds has 524 rows and 4 columns. Each observation (i.e., row) is a particular permission requested by the app indicated in that row. The four columns (with their data types in the parenthesis) are:
App_Type (character): The category of the app. Apps are categorized into a set of app types. Each app belongs to one.
Name (character): The name of the app.
Permission (character): The name of the permission requested by the app.
Permission_Type (character): The category of the permission. Each permission belongs to only one permission type.
If an app requests multiple permissions, there are that many rows for the app in the dataset. Therefore, each observation is uniquely identified by Name and Permission.
When you save the mobile.rds in your working directory, you can load the data as follows.
mobile <- readRDS(“mobile.rds”) Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question. Flag this QuestionQuestion 5 8 pts You are interested in identifying the app that requests the largest number of permissions from its mobile users?The name of the app that requests the greatest number of permissions is . How many permissions does that app request?  Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question. Flag this QuestionQuestion 6 8 pts How many different (unique) permissions are there in our data set?  There are two permissions requested by the greatest number of different apps. Create a new data frame (let’s called it as df) which will list those two permissions in the first column (named as Permission) and the number of apps which request them in the second column (named as num_app).df should look like this:Please complete the code that would create df?

df <- mobile %>% 
        group_by( permission ) %>% 
        summarise (num_app = n ()) %>% 
        filter(num_app == (num_app))

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 7 8 pts
Please use mobile data frame loaded from the rds file and df data frame created in Q6 (also shown in the screenshot above). You are interested in creating a new data frame that would list the names of the apps which request the two permissions indentified in Q6. Please complete the following code to create the data frame of interest.
dfq7 <- (mobile, df) %>% 
             group_by(Name) %>% 
              (requested = if_else(max(num_app, na.rm = TRUE)>0, , )) %>% 
             filter(requested) %>% 
             select(- )

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 8 8 pts
Permissions are categorized into permission types (Permission_Type columnn).
What is the number of different permission types?
What is the permission type which has the smallest number of permissions associated with it? Please complete the code to find that category?
mobile %>% 
       group_by( ) %>% 
        (number_permission = n ()) %>% 
       filter(number_permission == (number_permission))

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
CASE 3: USE THIS CASE AND THE TWO DATASETS (Games.rds AND Players.rds) TO ANSWER QUESTIONS 9 THROUGH 12
The attached datasets contain data on players and games on the most recent two weeks of the National Basketball Association (NBA) games.
There are two datasets that you need to download (Games.rds and Player.rds) and use to answer Questions 9, 10, 11, and 12 of this assignment.
You may need to merge the two datasets to answer some of the questions.
Games.rds
The Games.rds dataset contains key game stats for players. An observation (a row) represents a player in a particular game. The dataset contains the following variables:
player_id (character): A randomly assigned combination of letter and number that identifies an NBA player.
game_id (character): The three or four letters that precede the @ sign denotes the abbreviation for the “away” team that is playing at the “home” of another team. The abbreviation for the “home” team is the three or four letters that come after the @ sign. For example, chi@den means that chi (Chicago Bulls) is the “away” team that is playing at the “home” of den (Denver Nuggets). In this dataset; the placement of the team names in the game_id variable matters; for example, chi@den is treated as a different and separate game from den@chi. Furthermore, there can only be one game for each of team1@team2 combinations; for example, there can only be one game for chi@den.
pts (numerical): Points scored by the player in this game. A player earns two or three points for every basket made.
reb (numerical): The number of rebounds the player achieved in this game. A player earns a rebound for gaining possession of a missed shot after it bounces off the backboard or basketball rim.
ast (numerical): The number of assists that the player made in this game. A player earns an assist for every pass made leading to a basket made.
to (numerical): The number of turnovers the player committed in this game. A player commits a turnover when he/she loses possession of the ball to the opposing team.
Players.rds
The Games.rds dataset contains the following variables:
player_id (character): A randomly assigned combination of letter and number that identifies an NBA player.
first_name (character): The first name of an NBA player.
last_name (character): The last name of an NBA player.
team_name (character): The team represented by the NBA player.

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 9 8 pts
Load the datasets into your R session. Now you have Games data frame (loaded from Games.rds) and Players data frame (loaded from Players.rds) in your R session.
You want to merge these two datasets. For these two datasets, whether you use inner_join() or left_join(), the merge datasets would have the same number of rows.

[ Select ]

[“TRUE”, “FALSE”, “Not enough information to answer the question”]

Suppose you had successfully merged the two datasets. player_id variable alone can uniquely identify each observation the merged dataset?

[ Select ]

[“TRUE”, “FALSE”, “Not enough information to answer the question”]

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 10 8 pts
The NBA Most Valuable Player (MVP) award is an annual award given to the best performing player of the regular season in the NBA. Based on two weeks of NBA action in the month of November, the NBA has already considered six (6) MVP candidates (refer to the attached Players.rds and Games.rds datasets). Based on previous years, players winning the award had averaged at least 23 points (pts) per game, averaged at least 5 rebounds (reb) a game, averaged at least 5 assists (ast) a game, and averaged at most 5 turnovers (to) a game.
Based only on the above criteria, how many player(s) is/are on track to win this award? That, how many player(s) satisfy all the criteria. Type the NUMBER only.

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 11 8 pts
The criteria provided in the previous question are based on historical data. In fact, there are no such requirements to winning the MVP award. Rather, the player who accumulates the highest game scores throughout the NBA season will win the award.
Each player earns a game score in every game in which he participated.
For the purposes of this question (that is, to determine a player’s game score in each game), every 1 point (pts) translates to a score of 1; every 1 rebound (reb) translates to a score of 2, every 1 assist (ast) translates to a score of 2, and every turnover (to) translates to a score of negative 3. Notice that a point is NOT necessarily the same as a score.
Which player had the highest game score (NOT points) in a SINGLE game? Provide the LAST NAME of that player ONLY. (Do not use quotations)
What was the game score obtained by the player you identified in that single game? Enter the NUMBER only.

Move To… This element is a more accessible alternative to drag & drop reordering. Press Enter or Space to move this question.
Flag this Question
Question 12 8 pts
Instead of calculating a player’s game score in each game, we now want you to calculate each player’s total scores across all the games in which he participated.
Recall the assumptions used in Question 11, which still apply in in this question. In every game, every 1 point (pts) translates to a score of 1; every 1 rebound (reb) translates to a score of 2, every 1 assist (ast) translates to a score of 2, and every turnover (to) translates to a score of negative 3. Notice that a point is NOT necessarily the same as a score.
Which player had the highest accumulated game scores (NOT points) in all the games he had participated? Provide the LAST NAME of that player ONLY. (Do not use quotation marks)
What was the total (accumulated) game scores obtained by that player? Enter the NUMBER only.

Quiz saved at 4:48pm Submit Quiz
You have been logged out of canvas.
To continue please log in
Questions
•Haven’t Answered YetSpacer
•AnsweredQuestion 1
•AnsweredQuestion 2
•AnsweredQuestion 3
•AnsweredQuestion 4
•Haven’t Answered YetSpacer
•Haven’t Answered YetQuestion 5
•Haven’t Answered YetQuestion 6
•Haven’t Answered YetQuestion 7
•Haven’t Answered YetQuestion 8
•Haven’t Answered YetSpacer
•AnsweredQuestion 9
•Haven’t Answered YetQuestion 10
•Haven’t Answered YetQuestion 11
•Haven’t Answered YetQuestion 12
Time Elapsed:
Attempt due: Dec 10 at 1am

8 Days, 4 Hours, 0 Minutes, 29 Seconds


原文

提供更好的翻译建议

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 R game Java javascript theory You need to have JavaScript enabled in order to access this site.
30 $