TITLE(gl @@ Generate Factor Levels)
USAGE(
gl(n, k, length, labels=1:n, ordered=FALSE)
)
ALIAS(gl)
VALUE(
This function generates factors by specifying the
pattern of their levels.
The result has levels from LANG(1) to LANG(n)
with each value replicated in groups of length
LANG(k) out to a total length of LANG(length).
Labels for the resulting factor levels can be
optionally specified with the arguments LANG(labels)
and the factor levels can be made ordered by
specifying LANG(ordered=TRUE).
LANG(gl) is modelled on the ITALIC(GLIM) function of the
same name.
)
EXAMPLES(
# 20 alternating 1s and 2s
gl(2, 1, 20)
BLANK
# alternating pairs of 1s and 2s
gl(2, 2, 20)
)
