gl {base}
Description
Generate factors by specifying the pattern of their levels.
Usage
gl(n, k, length = n*k, labels = 1:n, ordered = FALSE)
Arguments
- n
- an integer giving the number of levels.
- k
- an integer giving the number of replications.
- length
- an integer giving the length of the result.
- labels
- an optional vector of labels for the resulting factor levels.
- ordered
- a logical indicating whether the result should be ordered or not.
Values
The result has levels from 1 to n with each value replicated in groups of length k out to a total length of length.
gl is modelled on the GLIM function of the same name.
See Also
The underlying factor().
Examples
Documentation reproduced from R 2.15.0. License: GPL-2.
