model_get_nlevels function

Get the number of levels for each factor used in xlevels