Points per game (PPG) measures a player's average scoring in each game. Calculate it by dividing total points (PTS) by games played (G), then format the result to one decimal place. section 19.3.2
Comparing NBA scoring leaders
Filter out marginal players with fewer than 2 PPG or fewer than 20 games, select each year's maximum PPG, and display the leaders in a bar chart. Wilt Chamberlain's 50.4 PPG in 1961–62 and 44.8 PPG in 1962–63 stand out. section 19.3.2 section 19.4
dat2 %>% mutate(PPG = format(PTS/G, digits = 1, nsmall = 1)) -> dat2 head(dat2) ## # A tibble: 6 × 6 ## # Groups: Year, Player [6] ## Year Player Pos G PTS PPG ## <fct> <chr> <fct> <int> <int> <chr> ## 1 1950 Al Cervi* PG 56 573 10.2 ## 2 1950 Al Guokas F-G 57 214 3.8 ## 3 1950 Al Miksis C 8 27 3.4 ## 4 1950 Alex Groza C 64 1496 23.4 ## 5 1950 Alex Hannum* PF 64 482 7.5 ## 6 1950 Andrew Levane F-G 60 332 5.5
R code creates PPG from PTS divided by G and shows the resulting one-decimal values. section 19.3.2
