A draft pick is a player's selection number in the NBA first round. The variable Pk ranges from 1 through 30: James Harden, for example, was the third pick in 2009. section 3.4
Draft position matters because teams seeking potential superstars have the strongest incentive to reach the top of the draft board. Players selected in positions 1–5 outperform later segments, while differences largely disappear after picks 11–15. section 3.1 section 3.6
For segmentation analysis, group the 30 possible first-round positions into six categorical ranges:
- 1–5, 6–10, 11–15, 16–20, 21–25, and 26–30. section 3.4
- Assign NA when Pk falls outside the valid 1–30 range. section 3.4
- Convert the resulting Pk2 character values into a categorical variable before comparing groups. section 3.4
mutate(draft2, Pk2 = ifelse(Pk %in% 1:5, "1-5",
ifelse(Pk %in% 6:10, "6-10",
ifelse(Pk %in% 11:15, "11-15",
ifelse(Pk %in% 16:20, "16-20",
ifelse(Pk %in% 21:25, "21-25",
ifelse(Pk %in% 26:30, "26-30", "NA"))))))) -> draft2
Create Pk2 with nested ifelse() calls and %in%, then use as.factor() to treat the ranges categorically. section 3.4
