This project focuses on LBJ's career stats, including overall stats, shooting stats and the data when he against others, also the comparsion about how he played on different teams and ages.
Data Source: A. LeBron James’s total stats in regular session and playoff games from 2003 to 2021 https://www.basketball-reference.com/players/j/jamesle01/gamelog/2021
B. LeBron James’s shooting distance in regular session and playoff games from 2003 to 2021 https://www.nba.com/stats/events/?flag=3&CFID=33&CFPARAMS=2020-21&PlayerID=2544&ContextMeasure=FGA&Season=2020-21§ion=player&sct=plot
I have been an NBA fan when I was a kid. There are over 400 players in NBA, and in every single year, some of them could be eliminated. In a such competitive league, LeBron James not only still survive, but also one of the legends in NBA. Although he is 37 years old, he is still among the top performers in the league. As a result, I am interested with his career data and would like to verify that if LeBron James’s stats are not affected by his physical age and other factors.
There is a lot of analytical data can be found on the Internet; however, most of them are season by season and lack an overall integrated analysis. Hence, I would like to know more about his career integrated data changes. From NBA fans side, we could expect how his games may look like and how his style of playing ball could change in the future.
Step 1: Obtain data and save into .csv files
Step 2: Combine files
each season’s data have to combine together by using R libraries, readr
and data.table
, and for loop
Step 3: Transform into a data frame
Transform the data from a csv
file into a dataframe
to have better view and easier to clean the data by using R library tidyverse
.
Step 4: Clean data
There are some “Inactive”, “Did Not Dress” or “Did Not Play” records in data which need to be deleted.
Check the dataset by using Tableau
By R
:
The graph tells the stats in first five year and recent five year.
Displays the situation in different teams.
By Tableau
:
3 point shooting attempts VS Field goal (2 points) shooting attempts trend
The data of shooting, separating by first five years and recent five year in two colors which can tell that how the shooting area change.
More Exploartions check out in Project file!
The visualization part is done by R Shiny
. The data I used is from 2003 to 2022, which is from his first career year till now.
The completed R script can be found in DVP.R
file. The needed data are dvpallgame.csv
, shot_accuracy.csv
, dvpshooting.csv
and winrate.csv
.
This page shows the overall trend from the first career year to 2022. There are four interactive plots. 2/3 point shooting stats and rebound/block stats.
plot-
On the top left is shooting attempt trend, we focus on 2 point and 3 point shot. As we all know, when people impacted by aging, they usually change their playing style from the shot closed to basket to 3 point shot in order to avoid body collision and protect themselves.
On the top right is rebound/block trend. Again, when player influenced by aging, their physical status may not be as good as when they were young, and the relative rebounds and blocks will decline, because the body can no longer withstand too many bounces and collisions.
When mouse hovering, the stats of corresponding age will be highlight.
The second page focus on the shooting stats.
From the top to bottom, the plots would like to display- shooting accuracy at different zones, shooting frequency, total number of shooting attempt and the shooting type proportion.
The users first can choose whether they want to compare the stats by different teams or age.
While team- there are four selections
While age- the drop down menu change the team options to age from 18 to 37 years old.
For example, users can choose 18 vs 28 to compare and check out the data at the sepecfic age.
The final page is abot the win rate when against other teams. There are two plot on this page, one is map and the other is a bar chart.
Again, users can choose whether they would like to know more about in different teams or ages-
When click on the logo on the map, it shows the detail data including win rate, points, field goals, 3 points, rebounds and blocks on average of all period (team or age).
Below is a bar chart, when mouse hover, the selected bar would be highlight.
This project done by R Shiny. Shiny is one of the tools that allow users to build a webpage visualzation with interactive functions; however, customized design is not easy to implement by Shiny. As a result, the next step I am tring to do is to implement the visualization part by D3
which is one of the packages that in javascript.