# ngrps

From lme4 v1.1-21
by Ben Bolker

##### Number of Levels of a Factor or a "merMod" Model

Returns the number of levels of a `factor`

or a set of
factors, currently e.g., for each of the grouping factors of
`lmer()`

, `glmer()`

, etc.

##### Usage

`ngrps(object, …)`

##### Arguments

- object
an

`R`

object, see Details.- …
currently ignored.

##### Details

Currently there are methods for objects of class
`'>merMod`

, i.e., the result of `lmer()`

etc,
and `factor`

objects.

##### Value

The number of levels (of a factor) or vector of number of levels for each “grouping factor” of a

##### Examples

```
# NOT RUN {
ngrps(factor(seq(1,10,2)))
ngrps(lmer(Reaction ~ 1|Subject, sleepstudy))
## A named vector if there's more than one grouping factor :
ngrps(lmer(strength ~ (1|batch/cask), Pastes))
## cask:batch batch
## 30 10
methods(ngrps) # -> "factor" and "merMod"
# }
```

*Documentation reproduced from package lme4, version 1.1-21, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.