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