Hasilkan faktor dengan menentukan pola levelnya.
gl(n, k, length = n*k, labels = seq_len(n), ordered = FALSE)
| Parameter | Deskripsi |
|---|---|
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. |
# NOT RUN {
## First control, then treatment:
gl(2, 8, labels = c("Control", "Treat"))
## 20 alternating 1s and 2s
gl(2, 1, 20)
## alternating pairs of 1s and 2s
gl(2, 2, 20)
# }