library(poliscidata)
# Collapsing numeric variables into roughly equal-sized groups (quantiles)
describe(world$pop_urban)
world$pop_urban.5cat = cut2(world$pop_urban, g=5)
# the next two lines not strictly necessary but should check our work
levels(world$pop_urban.5cat)
freq(world$pop_urban.5cat, plot=F)
12 | ||||||