nlevels: The Number of Levels of a Factor

Description Usage Arguments Details Value See Also Examples

View source: R/factor.R

Description

Return the number of levels which its argument has.

Usage

1

Arguments

x

an object, usually a factor.

Details

This is usually applied to a factor, but other objects can have levels.

The actual factor levels (if they exist) can be obtained with the levels function.

Value

The length of levels(x), which is zero if x has no levels.

See Also

levels, factor.

Examples

1
nlevels(gl(3, 7)) # = 3

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.