This help topic is for R version 1.7.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/interaction.html
interaction {base}R Documentation

Compute Factor Interactions

Description

interaction computes a factor which represents the interaction of the given factors. The result of interaction is always unordered.

Usage

interaction(..., drop=FALSE)

Arguments

...

The factors for which interaction is to be computed, or a single list giving those factors.

drop

If drop is TRUE, empty factor levels are dropped from the result. The default is to retain all factor levels.

Value

A factor which represents the interaction of the given factors.

References

Chambers, J. M. and Hastie, T. J. (1992) Statistical Models in S. Wadsworth \& Brooks/Cole.

See Also

factor.

Examples

a <- gl(2, 2, 8)
b <- gl(2, 4, 8)
interaction(a, b)

[Package base version 1.7.1 ]