interaksi menghitung faktor yang mewakili interaksi faktor-faktor tertentu. Hasil interaksi selalu tidak teratur.
interaction(…, drop = FALSE, sep = ".", lex.order = FALSE)
| Parameter | Deskripsi |
|---|---|
… |
the factors for which interaction is to be computed, or a single list giving those factors. |
drop |
if drop is TRUE, unused factor levels are dropped from the result. The default is to retain all factor levels. |
sep |
string to construct the new level labels by joining the constituent ones. |
lex.order |
logical indicating if the order of factor concatenation should be lexically ordered. |
# NOT RUN {
a <- gl(2, 4, 8)
b <- gl(2, 2, 8, labels = c("ctrl", "treat"))
s <- gl(2, 1, 8, labels = c("M", "F"))
interaction(a, b)
interaction(a, b, s, sep = ":")
stopifnot(identical(a:s,
interaction(a, s, sep = ":", lex.order = TRUE)),
identical(a:s:b,
interaction(a, s, b, sep = ":", lex.order = TRUE)))
# }