The %in% operator tests whether each element occurs in a specified vector or data frame. It returns a logical result that can guide conditional assignment or row filtering. section 3.4 section 12.4
Group NBA draft picks into segments
To turn the numeric Pk variable into six draft-selection groups, test membership in ranges: `ifelse(Pk %in% 1:5, "1-5", ifelse(Pk %in% 6:10, "6-10", ...))`. Values from 1 through 30 receive a category; other values become `NA`. Convert the resulting categorical variable with `as.factor(Pk2)` before computing statistics or creating visualizations. section 3.4
Remove incomplete seasons
Create a vector of unwanted season levels and negate the membership test: `gini[!(gini$season_end %in% c(1985, 1986, 1987, 1988, 1989, 1990)), ] -> gini3`. The `!` changes membership into exclusion, reducing the data from 14,163 to 12,929 records. section 12.4
