Import data

https://www.hockey-reference.com/leagues/NHL_2023_skaters.html#stats::goals

# excel file
NHL <- read_excel("../00_data/NHL_skaterStat_2022-23.xlsx")
NHL

# Remove column names in the middle of the dataset
NHL

State one question

What age enables an NHL player to score more points than the others? # Plot data

Plot data

ggplot(data = NHL) + 
  geom_bin2d(mapping = aes(x = Age, y = PTS))

Interpret

The highest scorers are around 26 years old. In addition, the brightest color at the bottom of at 25 indicates most players are around 25 years old, many of whom score few.