Use dplyr’s across() inside summarize() to apply the same calculation across selected columns. In salary analysis, it computes mean payrolls for consecutive season columns while na.rm = TRUE ignores missing values. section 10.3
Average NBA payroll by season
salaries %>% summarize(across(s2017:s2000, mean, na.rm = TRUE)) produces one row with 18 seasonal averages. Apply the same pattern to adjusted salary columns with across(sa2017:sa2000, mean, na.rm = TRUE), then use pivot_longer() to prepare the results for plotting. section 10.3
