Q3

.pdf

School

University of Waterloo *

*We aren’t endorsed by this school

Course

442

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

4

Uploaded by BailiffJellyfishMaster1195 on coursehero.com

STAT 442/842 CM 762: Assignment 2 DUE: Wednesday November 2, 2022 by 11:59pm EST NOTES This assignment has four parts - All programming questions. Each part should be submitted as a separate PDF document. Your assignment must be submitted by the due date listed at the top of this document, and it must be submitted electronically in .pdf format via Crowdmark. This means that your responses for different question parts should begin on separate pages of your .pdf file. Note that your .pdf solution file must have been generated by R Markdown. Additionally: Organization and comprehensibility is part of a full solution. Consequently, points will be deducted for solutions that are not organized and incomprehensible. Furthermore, if you submit your assignment to Crowdmark, but you do so incorrectly in any way (e.g., you upload your Question 2 solution in the Question 1 box), you will receive a 5% deduction (i.e., 5% of the assignment’s point total will be deducted from your point total). 1
Question 3 - NBA Player Boxscores, huxtable (18 marks) Take the NBA Player Boxscore data provided and build a huxtable of the top 15 players in the league by total points scored. The table should. . . Include six columns: player name, position (most common if they have more than one), total points, team, games played, and mean points per game. (3 marks) Should have an alternating white-grey background for text cells.(2 marks) Should have a solid border around and italic text on ONLY the games played of any player than played 75 or more games in the season. (This data only includes one regular season.) (3 marks) Should round mean points to per game to the nearest 0.1. (2 marks) Should have bolded column headers (i.e., variable names) (1 mark) Should have human readable column headers. (e.g., “points”, not “pts”, and “position”, not “ath- lete_position_name”) (2 marks) Should have a border between the column headers and the rest of the data. (1 mark) For full marks, show the table, and both the pipeline code used to arrange the data and the huxtable code. (4 marks for arranging code) Player name is athlete_short_name , position is athlete_position_name or athlete_position_abbreviation , points is pts , team is team_short_display_name . Games played and mean points will need to be derived by you. library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.2 -- ## v ggplot2 3.3.6 v purrr 0.3.4 ## v tibble 3.1.8 v dplyr 1.0.10 ## v tidyr 1.2.1 v stringr 1.4.1 ## v readr 2.1.3 v forcats 0.5.2 ## -- Conflicts ------------------------------------------ tidyverse_conflicts() -- ## x dplyr::filter() masks stats::filter() ## x dplyr::lag() masks stats::lag() library(huxtable) ## ## Attaching package: ' huxtable ' ## ## The following object is masked from ' package:dplyr ' : ## ## add_rownames ## ## The following object is masked from ' package:ggplot2 ' : ## ## theme_grey # Read Data from the csv File data <- read.csv( ' NBA_Player_Boxscore_2021-22.csv ' ) # Take athlete data after grouping them by ID # Take desired columns i.e. Name, most occuring # position for each player, total points by each # player, team of that player and number of games played # Sort them by total points and add mean points per game. # take top 15 top_athletes_data <- data %>% 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help