Skip to contents

Get the number of levels for each factor used in xlevels

Usage

model_get_nlevels(model)

# Default S3 method
model_get_nlevels(model)

Arguments

model

(a model object, e.g. glm)
A model object.

Value

a tibble with two columns: "variable" and "var_nlevels"

Examples

lm(hp ~ mpg + factor(cyl), mtcars) |>
  model_get_nlevels()
#> # A tibble: 1 × 2
#>   variable    var_nlevels
#>   <chr>             <int>
#> 1 factor(cyl)           3