Rev 38838 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{interaction}\title{Compute Factor Interactions}\usage{interaction(\dots, drop = FALSE, sep = ".")}\alias{interaction}\arguments{\item{\dots}{the factors for which interaction is to be computed, or asingle list giving those factors.}\item{drop}{if \code{drop} is \code{TRUE}, unused factor levelsare dropped from the result. The default is to retain allfactor levels.}\item{sep}{string to construct the new level labels by joining theconstituent ones.}}\description{\code{interaction} computes a factor which represents the interactionof the given factors. The result of \code{interaction} is always unordered.}\value{A factor which represents the interaction of the given factors.The levels are labelled as the levels of the individual factors joinedby \code{sep}, i.e. \code{.} by default.As from \R 2.4.0 the levels are ordered so the level of the firstfactor varies fastest, then the second and so on. This is the reverseof lexicographic ordering.}\references{Chambers, J. M. and Hastie, T. J. (1992)\emph{Statistical Models in S}.Wadsworth \& Brooks/Cole.}\seealso{\code{\link{factor}}; \code{\link{:}} where \code{f:g} is the same as\code{interaction(f,g, sep=":")} when \code{f} and \code{g} are factors.}\examples{a <- gl(2, 4, 8)b <- gl(2, 2, 8, label = c("ctrl", "treat"))s <- gl(2, 1, 8, label = c("M", "F"))interaction(a, b)interaction(a, b, s, sep = ":")}\keyword{category}