In Module 3, we were introduced to Interactive Visualizations using R. For my final project, I will apply what I have learned and create an application in shiny using NBA player statistics data. The targeted audience for this app includes sport fans, gamblers and those interested in comparing players across a number of categories. The data includes simple categories such as: age, position the player plays, number of games played in a given season, points scored etc. Sports gambling has definitely been popular for years and specifically I would like to emulate the format that the sports gambling platform “DraftKings” utilizes. DraftKings calculates a “total fantasy points scored” based on multiple statistics such as points, rebounds, assists, steals, blocks, turnovers, three pointers made etc. I would like to provide some background on how I was able to manipulate the data and some weaknesses of the data.

Background

The NBA 2020-2021 season will start on December 22nd, 2020. It makes most sense to analyze player data from the previous season in order to predict which players will perform strongly in the upcoming season. However, with COVID-19 shutting down the 2019-2020 season, there is a lack of season data available in comparison to the typical 82 games. I decided to utilize 2018-2019 data. This will still be a challenge because the rookies from 2019-2020 will be omitted and improved players such as Bam Adebayo, Luka Doncic, Devonte Graham, Brandon Ingram etc. will be undervalued in terms of “total fantasy points scored”.

Data Dictionary

variable description
FULL.NAME player
TEAM first three letters of team city
POS position(s) the player plays (guard, forward, center)
AGE player age
GP number of Games Played (max is 82)
MPG minutes Played Per Game
USG estimate of the percentage of team plays used by a player while he was on the floor
X3PA total three-pointers attempted
X3P. percentage of three-pointers made
PPG points per game
RPG rebounds per game
APG assists per game
SPG steals per game
BPG blocks per game
TOPG turnovers per game

Load Data

The following code loads the 2018-2019 player data and filters out for players that played at least 60 of the 82 games and played an average of at least 25 minutes per game. A full NBA game is 48 minutes assuming no overtime, so I decided to only include players who play a little more than half the game.

The original data contains 530 players and 24 statistics/details for each of the players. The total observations is 622 because some players are duplicates after being traded to another team.

#load data from Github path
nba_playerdata <- read.csv("https://raw.githubusercontent.com/aaronzalkisps/data608/master/nbaplayerdata.csv", TRUE, ",")
#choose columns interested in
subset_data <-  nba_playerdata[c(1,2,3,4,5,6,7,13,14,17,18,20,22,23,24)]
conditions <- filter (subset_data, GP > 60, MPG > 25)

Manipulate Data

We can sort the data by most points per game. Certain European players have non-ascii characters in their names and we need to clean this in order to successfully run kable function from the kableExtra package. We are now left with 115 observations and the 15 variables of interest.

#sort
df <- conditions[with(conditions, order(-PPG)), ]

#European Players
df$FULL.NAME[(df$FULL.NAME)=="Nikola Vu?evi?"]<- "Nikola Vucevic" 
df$FULL.NAME[(df$FULL.NAME)=="Luka Don?i?"]<- "Luka Doncic" 
df$FULL.NAME[(df$FULL.NAME)=="Nikola Joki?"]<- "Nikola Jokic" 
df$FULL.NAME[(df$FULL.NAME)=="Bojan Bogdanovi?"]<- "Bojan Bogdanovic" 
df$FULL.NAME[(df$FULL.NAME)=="Jusuf Nurki?"]<- "Jusuf Nurkic" 
df$FULL.NAME[(df$FULL.NAME)=="Bogdan Bogdanovi?"]<- "Bogdan Bogdanovic" 

#display top 6 scorers
head (df)
##               FULL.NAME TEAM POS   AGE GP  MPG  USG X3PA  X3P.  PPG  RPG APG
## 1          James Harden  Hou   G 29.63 78 36.8 40.5 1028 0.368 36.1  6.6 7.5
## 2           Paul George  Okc   F 28.94 77 36.9 29.5  757 0.386 28.0  8.1 4.1
## 3 Giannis Antetokounmpo  Mil   F 24.35 72 32.8 32.3  203 0.256 27.7 12.5 5.9
## 4           Joel Embiid  Phi F-C 25.07 64 33.7 33.3  263 0.300 27.5 13.6 3.7
## 5         Stephen Curry  Gol   G 31.07 69 33.8 30.4  810 0.437 27.3  5.3 5.2
## 6          Devin Booker  Pho   G 22.44 64 35.0 32.9  414 0.326 26.6  4.1 6.8
##    SPG  BPG TOPG
## 1 2.05 0.73 4.96
## 2 2.21 0.44 2.66
## 3 1.26 1.53 3.71
## 4 0.72 1.91 3.55
## 5 1.33 0.38 2.78
## 6 0.88 0.20 4.13

Calculate Fantasy Points

The way DraftKings calculates total points can be found here.

In sum:

  • 0.5 points for a three-pointer made
  • 1 point for points scored
  • 1.25 points for rebounds
  • 1.5 points for assists
  • 2 points for steals
  • 2 points for blocks
  • 0.5 points deducted for each turnover

Based on the above metrics, we need to run the following code to calculate how many threes made a player averaged per game.

( X3PA * X3P. ) / (GP )

# calculate three pointers made per game
TPM <- (df$X3PA*df$X3P.)/(df$GP)

df2 <- cbind (df, TPM)
df <-  df2[c(1,2,3,4,5,6,7,10,11,12,13,14,15,16)]
#rename columns
names (df) <- c("Player","Team","Position","Age", "GP", "MPG", "USG%", "PPG", "RPG", "APG","SPG","BPG","TOPG", "3PM")

We now have all metrics necessary to calculate Total DraftKings Fantasy Points. 3PM represents Three Pointers Made per game. Let’s calculate using the above DraftKings rules.

(PPG * 1) + (3PM * 0.5) + (RPG * 1.25) + (APG * 1.5) + (SPG * 2) + (BPG * 2) - (TOPG * 0.5)

TFPG <- (df$PPG*1)+(df$`3PM`*0.5)+(df$RPG*1.25)+(df$APG*1.5)+(df$SPG*2)+(df$BPG*2)-(df$TOPG*0.5)
df2 <- cbind (df, TFPG)
TFP <- (df2$TFPG * df2$GP)
df <- cbind (df2, TFP)

Final Dataframe

#tabular visual
kable(df) %>%
  kable_styling(bootstrap_options = "bordered") %>%
  row_spec(0, bold = T, color = "black", background = "#7fcdbb")
Player Team Position Age GP MPG USG% PPG RPG APG SPG BPG TOPG 3PM TFPG TFP
James Harden Hou G 29.63 78 36.8 40.5 36.1 6.6 7.5 2.05 0.73 4.96 4.8500513 61.10503 4766.192
Paul George Okc F 28.94 77 36.9 29.5 28.0 8.1 4.1 2.21 0.44 2.66 3.7948312 50.14242 3860.966
Giannis Antetokounmpo Mil F 24.35 72 32.8 32.3 27.7 12.5 5.9 1.26 1.53 3.71 0.7217778 56.26089 4050.784
Joel Embiid Phi F-C 25.07 64 33.7 33.3 27.5 13.6 3.7 0.72 1.91 3.55 1.2328125 54.15141 3465.690
Stephen Curry Gol G 31.07 69 33.8 30.4 27.3 5.3 5.2 1.33 0.38 2.78 5.1300000 46.32000 3196.080
Devin Booker Pho G 22.44 64 35.0 32.9 26.6 4.1 6.8 0.88 0.20 4.13 2.1088125 43.07441 2756.762
Kevin Durant Gol F 30.53 78 34.6 29.0 26.0 6.4 5.9 0.76 1.08 2.87 1.7559487 45.97297 3585.892
Damian Lillard Por G 28.74 80 35.5 29.3 25.8 4.6 6.9 1.11 0.41 2.65 2.9658375 45.09792 3607.834
Bradley Beal Was G 25.79 82 36.9 28.4 25.6 5.0 5.5 1.50 0.70 2.72 2.5511707 44.41559 3642.078
Kemba Walker Cha G 28.93 82 34.9 31.5 25.6 4.4 5.9 1.24 0.41 2.57 3.1692683 43.54963 3571.070
Blake Griffin Det F 30.07 75 35.0 30.2 24.5 7.5 5.4 0.69 0.37 3.37 2.5195200 43.66976 3275.232
Karl-Anthony Towns Min F-C 23.40 77 33.0 29.0 24.4 12.4 3.4 0.88 1.62 3.13 1.8441558 49.35708 3800.495
Kyrie Irving Bos G 27.05 67 33.0 29.6 23.8 5.0 6.9 1.55 0.51 2.57 2.5975224 44.53376 2983.762
Donovan Mitchell Uta G 22.59 77 33.7 31.6 23.8 4.1 4.2 1.38 0.40 2.83 2.4446753 38.59234 2971.610
Zach LaVine Chi G 24.09 63 34.5 30.5 23.7 4.7 4.5 0.95 0.41 3.43 1.9056190 38.28281 2411.817
Russell Westbrook Okc G 30.41 73 36.0 30.9 22.9 11.1 10.7 1.95 0.45 4.44 1.6327397 56.22137 4104.160
Klay Thompson Gol G 29.17 78 34.0 25.5 21.5 3.8 2.4 1.06 0.60 1.46 3.0871538 33.98358 2650.719
Julius Randle Nor F 24.37 73 30.6 27.8 21.4 8.7 3.1 0.71 0.62 2.85 0.9189041 38.61945 2819.220
LaMarcus Aldridge San F 33.73 81 33.2 27.0 21.3 9.2 2.4 0.54 1.32 1.78 0.1234074 39.29170 3182.628
DeMar DeRozan San G 29.68 77 34.9 27.9 21.2 6.0 6.2 1.12 0.47 2.57 0.0911688 39.94058 3075.425
Luka Doncic Dal G-F 20.12 72 32.2 30.5 21.2 7.8 6.0 1.08 0.35 3.42 2.3318056 42.26590 3043.145
Jrue Holiday Nor G 28.83 67 35.8 25.5 21.2 5.0 7.7 1.64 0.81 3.16 1.7608209 43.20041 2894.427
Mike Conley Mem G 31.50 70 33.5 27.3 21.1 3.4 6.4 1.34 0.31 1.86 2.2152000 38.42760 2689.932
D’Angelo Russell Bro G 23.13 81 30.2 31.9 21.1 3.9 7.0 1.22 0.25 3.12 2.8927778 39.30139 3183.412
CJ McCollum Por G 27.56 70 33.9 25.5 21.0 4.0 3.0 0.79 0.39 1.51 2.3839286 33.29696 2330.787
Nikola Vucevic Orl C 28.46 80 31.4 28.0 20.8 12.0 3.8 1.01 1.14 1.99 1.0510500 45.33053 3626.442
Buddy Hield Sac G 25.32 82 31.9 25.2 20.7 5.0 2.5 0.71 0.39 1.79 3.3899634 33.69998 2763.398
Nikola Jokic Den C 24.14 80 31.3 27.4 20.1 10.8 7.3 1.35 0.69 3.10 1.0361250 47.59806 3807.845
Lou Williams Lac G 32.46 75 26.6 32.5 20.0 3.0 5.3 0.75 0.15 2.41 1.4016000 32.99580 2474.685
Danilo Gallinari Lac F 30.67 68 30.3 23.8 19.8 6.1 2.6 0.72 0.34 1.44 2.3696471 33.90982 2305.868
John Collins Atl F-C 21.55 61 30.0 23.7 19.5 9.8 2.0 0.36 0.64 1.95 0.9013770 36.22569 2209.767
Trae Young Atl G 20.56 81 30.9 28.4 19.1 3.7 8.1 0.86 0.19 3.80 1.9280000 37.03900 3000.159
Kyle Kuzma Lal F 23.72 70 33.1 23.8 18.7 5.5 2.5 0.57 0.37 1.89 1.8266571 31.17333 2182.133
Khris Middleton Mil F 27.66 77 31.1 25.1 18.3 6.0 4.3 1.04 0.09 2.26 2.3269091 34.54345 2659.846
Jamal Murray Den G 22.13 75 32.6 24.9 18.2 4.2 4.8 0.89 0.36 2.11 2.0258400 33.10792 2483.094
Andrew Wiggins Min G-F 24.13 73 34.8 24.4 18.1 4.8 2.5 0.97 0.66 1.90 1.6160548 30.96803 2260.666
Bojan Bogdanovic Ind F 29.98 81 31.8 22.4 18.0 4.1 2.0 0.86 0.01 1.67 2.0253086 28.04265 2271.455
JJ Redick Phi G 34.80 76 31.3 21.8 18.0 2.4 2.7 0.42 0.21 1.30 3.1603289 27.24016 2070.253
Andre Drummond Det C 25.67 79 33.5 23.0 17.3 15.6 1.4 1.73 1.76 2.22 0.0634937 44.80175 3539.338
De’Aaron Fox Sac G 21.31 81 31.4 24.5 17.3 3.8 7.3 1.64 0.56 2.80 1.0626173 36.53131 2959.036
Pascal Siakam Tor F 25.03 80 31.8 20.8 16.9 6.9 3.1 0.93 0.64 1.91 0.9870750 32.85354 2628.283
Ben Simmons Phi G-F 22.72 79 34.2 22.1 16.9 8.8 7.7 1.42 0.77 3.47 0.0000000 42.09500 3325.505
Jordan Clarkson Cle G 26.84 81 27.3 27.6 16.8 3.3 2.4 0.69 0.17 1.67 1.7800000 26.30000 2130.300
Spencer Dinwiddie Bro G 26.01 68 28.1 24.9 16.8 2.4 4.6 0.59 0.25 2.22 1.8227941 28.18140 1916.335
Collin Sexton Cle G 20.27 82 31.8 25.2 16.7 2.9 3.0 0.54 0.07 2.27 1.4511220 25.63556 2102.116
Clint Capela Hou C 24.90 67 33.6 18.1 16.6 12.6 1.4 0.66 1.52 1.39 0.0000000 38.11500 2553.705
Montrezl Harrell Lac F-C 25.21 82 26.3 23.5 16.6 6.5 2.0 0.85 1.34 1.61 0.0364878 31.31824 2568.096
Josh Richardson Mia F 25.57 73 34.8 20.9 16.6 3.6 4.1 1.08 0.45 1.55 2.2446986 30.65735 2237.986
Deandre Ayton Pho C 20.72 71 30.7 21.2 16.3 10.3 1.8 0.87 0.94 1.77 0.0000000 34.61000 2457.310
Eric Gordon Hou G 30.29 68 31.7 22.0 16.2 2.2 1.9 0.60 0.40 1.32 3.1764706 24.72824 1681.520
Aaron Gordon Orl F 23.57 78 33.8 21.8 16.0 7.3 3.7 0.73 0.72 2.08 1.5526026 33.31130 2598.282
Eric Bledsoe Mil G 29.34 78 29.1 22.9 15.9 4.6 5.5 1.51 0.37 2.12 1.5901667 33.39508 2604.816
Rudy Gobert Uta C 26.79 81 31.8 17.8 15.9 12.8 2.0 0.81 2.30 1.60 0.0000000 40.32000 3265.920
Jayson Tatum Bos F 21.11 79 31.1 22.1 15.7 6.0 2.1 1.06 0.73 1.54 1.4683924 29.89420 2361.642
Malcolm Brogdon Mil G 26.33 64 28.6 20.7 15.6 4.5 3.2 0.72 0.19 1.44 1.6241250 27.93706 1787.972
Jusuf Nurkic Por C 24.63 72 27.4 24.7 15.6 10.4 3.2 0.97 1.43 2.33 0.0414861 37.05574 2668.014
Dennis Schroder Okc G 25.57 79 29.3 24.2 15.5 3.6 4.1 0.81 0.15 2.16 1.5711899 27.77559 2194.272
Reggie Jackson Det G 28.99 82 27.9 24.5 15.4 2.6 4.2 0.66 0.11 1.80 2.1195000 26.64975 2185.280
Jeremy Lamb Cha G 26.86 79 28.5 22.5 15.3 5.5 2.2 1.11 0.41 1.01 1.4536709 28.73684 2270.210
Evan Fournier Orl G-F 26.45 81 31.5 22.1 15.1 3.2 3.6 0.89 0.15 1.90 1.8888889 26.57444 2152.530
Terrence Ross Orl G-F 28.18 81 26.5 23.9 15.1 3.5 1.7 0.89 0.36 1.10 2.6762716 25.31314 2050.364
Serge Ibaka Tor F-C 29.56 74 27.2 22.8 15.0 8.1 1.3 0.39 1.38 1.53 0.6622973 30.18115 2233.405
Dwyane Wade Mia G 37.23 72 26.2 27.9 15.0 4.0 4.2 0.82 0.53 2.31 1.1962500 28.44312 2047.905
Marvin Bagley III Sac F 20.08 62 25.3 24.2 14.9 7.6 1.0 0.53 0.95 1.58 0.4846452 28.31232 1755.364
Kyle Lowry Tor G 33.05 65 34.1 19.6 14.2 4.8 8.7 1.40 0.48 2.80 2.4183231 36.81916 2393.245
Bogdan Bogdanovic Sac G 26.64 70 27.8 22.3 14.1 3.5 3.8 1.03 0.21 1.67 1.9131429 26.77657 1874.360
Steven Adams Okc C 25.73 80 33.4 16.4 13.9 9.5 1.6 1.49 0.96 1.73 0.0000000 32.21000 2576.800
Marcus Morris Bos F 29.61 75 27.9 20.9 13.9 6.1 1.5 0.57 0.33 1.23 1.9450000 25.93250 1944.938
Rudy Gay San F 32.65 69 26.7 22.1 13.7 6.8 2.6 0.78 0.49 1.64 1.0720000 28.35600 1956.564
Joe Harris Bro G-F 27.59 76 30.2 17.0 13.7 3.9 2.4 0.49 0.22 1.59 2.4074211 24.00371 1824.282
Jerami Grant Okc F 25.08 80 32.7 15.4 13.6 5.2 1.0 0.76 1.25 0.84 1.4357000 25.91785 2073.428
Al Horford Bos F-C 32.86 68 29.0 19.0 13.6 6.7 4.1 0.85 1.26 1.50 1.0747059 32.13235 2185.000
Myles Turner Ind F-C 23.05 74 28.6 20.0 13.3 7.2 1.6 0.81 2.69 1.35 1.0276757 31.53884 2333.874
Jaylen Brown Bos F 22.46 74 25.9 22.1 13.0 4.2 1.4 0.95 0.43 1.34 1.2830270 23.08151 1708.032
Cedi Osman Cle F 24.01 76 32.2 18.5 13.0 4.7 2.6 0.78 0.14 1.50 1.7125263 24.72126 1878.816
Kevin Knox Nyk F 19.67 75 28.8 22.4 12.8 4.5 1.1 0.56 0.32 1.53 1.6646933 21.90235 1642.676
Ricky Rubio Uta G 28.47 68 27.9 22.7 12.7 3.6 6.1 1.35 0.15 2.65 1.1616765 28.60584 1945.197
Paul Millsap Den F 34.16 70 27.1 19.6 12.6 7.2 2.0 1.17 0.77 1.36 0.8290714 28.21454 1975.017
Justise Winslow Mia F 23.04 66 29.7 20.8 12.6 5.4 4.3 1.09 0.29 2.15 1.4545455 28.21227 1862.010
Thaddeus Young Ind F 30.80 81 30.7 18.0 12.6 6.4 2.5 1.52 0.47 1.52 0.6290617 27.88453 2258.647
Brook Lopez Mil C 31.03 81 28.7 16.7 12.5 4.9 1.2 0.60 2.21 1.02 2.3071605 26.68858 2161.775
Jeff Green Was F 32.62 77 27.2 17.8 12.3 4.0 1.8 0.56 0.52 1.31 1.4420779 22.22604 1711.405
Joe Ingles Uta F 31.52 82 31.3 17.5 12.1 4.0 5.7 1.18 0.24 2.35 2.3030854 28.46654 2334.256
Willie Cauley-Stein Sac C 25.65 81 27.3 17.5 11.9 8.4 2.4 1.19 0.63 1.04 0.0123457 29.12617 2359.220
Jae Crowder Uta F 28.77 80 27.1 19.1 11.9 4.8 1.7 0.80 0.39 1.06 2.1597750 23.37989 1870.391
Bryn Forbes San G 25.72 82 28.0 17.4 11.8 2.9 2.1 0.55 0.05 0.98 2.1455854 20.35779 1669.339
D.J. Augustin Orl G 31.42 81 28.0 17.2 11.7 2.5 5.3 0.64 0.05 1.58 1.6164321 24.17322 1958.031
Gordon Hayward Bos F 29.05 72 25.9 19.0 11.5 4.5 3.4 0.82 0.32 1.46 1.0683750 24.30919 1750.262
Josh Jackson Pho F 22.16 79 25.2 23.9 11.5 4.4 2.3 0.92 0.71 2.19 0.9227848 23.07639 1823.035
Darren Collison Ind G 31.63 76 28.2 17.7 11.2 3.0 6.0 1.45 0.12 1.63 1.0389211 26.79446 2036.379
DeMarre Carroll Bro F 32.71 67 25.4 18.6 11.1 5.2 1.3 0.45 0.15 1.09 1.5828507 20.99643 1406.761
Fred VanVleet Tor G 25.12 64 27.5 17.9 11.0 2.6 4.8 0.89 0.30 1.27 1.7482500 24.06912 1540.424
Jarrett Allen Bro C 20.97 80 26.2 15.9 10.9 8.4 1.4 0.54 1.50 1.30 0.0748125 26.96741 2157.392
Dewayne Dedmon Atl C 29.66 64 25.1 16.7 10.8 7.5 1.4 1.08 1.13 1.31 1.2952188 26.68761 1708.007
Shai Gilgeous-Alexander Lac G 20.75 82 26.5 18.3 10.8 2.8 3.3 1.18 0.55 1.72 0.6221098 22.16105 1817.207
Damyean Dotson Nyk G 24.93 73 27.4 17.3 10.7 3.6 1.8 0.79 0.14 0.97 1.7240548 20.13703 1470.003
Danny Green Tor G-F 31.80 80 27.7 14.0 10.3 4.0 1.6 0.91 0.66 0.94 2.4738000 21.60690 1728.552
Marvin Williams Cha F 32.81 75 28.4 14.9 10.1 5.4 1.2 0.92 0.80 0.61 1.8641600 22.71708 1703.781
Derrick White San G 24.78 67 25.8 17.7 9.9 3.7 3.9 1.00 0.70 1.45 0.7163582 23.40818 1568.348
Kevin Huerter Atl G 20.62 75 27.3 15.7 9.7 3.3 2.9 0.88 0.33 1.45 1.8124800 20.77624 1558.218
Jonathan Isaac Orl F 21.52 75 26.6 16.3 9.6 5.5 1.1 0.79 1.29 1.01 1.1455733 22.35279 1676.459
Al-Farouq Aminu Por F 28.55 81 28.3 13.7 9.4 7.5 1.3 0.84 0.41 0.89 1.1856790 23.37284 1893.200
Larry Nance Jr.  Cle F 26.27 67 26.8 15.5 9.4 8.2 3.2 1.49 0.60 1.45 0.4929254 28.15146 1886.148
Nicolas Batum Cha G-F 30.32 75 31.4 13.2 9.3 5.2 3.3 0.95 0.57 1.56 1.5456267 23.78281 1783.711
Tomas Satoransky Was G-F 27.45 80 27.0 14.1 8.9 3.5 5.0 1.04 0.18 1.50 0.8007375 22.86537 1829.229
Marcus Smart Bos G 25.10 80 27.5 14.6 8.9 2.9 4.0 1.79 0.35 1.54 1.5743000 22.82215 1825.772
Noah Vonleh Nyk F 23.63 68 25.3 14.8 8.4 7.8 1.9 0.66 0.75 1.29 0.6769412 23.51347 1598.916
Mikal Bridges Pho F 22.61 82 29.5 12.2 8.3 3.2 2.1 1.55 0.46 0.85 1.2787195 19.68436 1614.118
Darius Miller Nor F 29.06 69 25.5 13.4 8.2 1.8 2.1 0.58 0.33 0.86 1.9255072 15.95275 1100.740
Josh Hart Lal G 24.10 67 25.6 13.5 7.8 3.7 1.4 0.96 0.60 0.87 1.3740896 17.89704 1199.102
Patrick Beverley Lac G 30.75 78 27.4 12.1 7.6 4.9 3.9 0.86 0.55 1.10 1.4374231 22.56371 1759.969
Draymond Green Gol F 29.10 66 31.3 13.1 7.4 7.3 6.9 1.44 1.08 2.56 0.7125000 30.99125 2045.422
PJ Tucker Hou F 33.93 82 34.2 9.5 7.3 5.8 1.2 1.62 0.45 0.77 1.7792561 20.99463 1721.560
Terrance Ferguson Okc G 20.90 74 26.1 10.6 6.9 1.9 1.0 0.54 0.22 0.65 1.4343243 12.68716 938.850
Cory Joseph Ind G 27.64 82 25.2 13.7 6.5 3.4 3.9 1.13 0.27 0.98 0.6714878 19.24574 1578.151

Shiny App

The application can be found here. There are two multi-select dropdowns. In order to eliminate a selection, use the ‘backspace’ key. The application allows to compare multiple players across multiple categories.

The default selections are Kevin Durant and Stephen Curry for the Player dropdown. The default selection is Points Per Game for the Attribute dropdown.

Conclusion

One important piece that makes this analysis flawed is that DraftKings also rewards total fantasy points if a player achieves a “double-double” or “triple-double”. This statistic is harder to average like the other statistics because a player either gets it or doesn’t. It’s really impossible to claim that a player averages n double-doubles or n triple-doubles.

On the bright side, the code used to reach the final data frame can easily be manipulated. For example, if a star player gets injured, then it might help to view the other team players who play less than 25 minutes per game and are expected to gain the star player’s minutes. In the end, sports gambling does truly come down to luck. As much as you prepare, a player can potentially get injured during the game or even ejected. In addition, if a team is winning by a large margin, the star player might not play the full game so that they can rest and prepare for the next game.