cat.slice function

Slice categorical variable