interaction {Hmisc} | R Documentation |
This is a replacement for the builtin function interaction
that adds
the parameters sep
and left
.
interaction(..., drop=FALSE, sep=".", left=FALSE)
... |
the arguments to interaction can be either a data frame containing
all the factors to be used
all the individual factors.
It will not understand a combination of factors and designs as arguments;
you have to pick one form or the other.
|
drop |
if TRUE the levels of the new factor not represented in the data are dropped.
|
sep |
the separator in creating the level descriptors. |
left |
set to TRUE to left-justify factor levels when constructing label strings
|
This is a slight modification of the S-supplied function. The sep
argument
has been added, a sort step has been added to properly sort the levels of
the created variable, and the left
parameter is added.
a new factor, whose levels are all possible combinations of the factors
supplied as arguments. If drop =TRUE
, only the levels represented in the
new factor are retained.
Temp <- c(160, 180, 160, 180, 160, 180, 160, 180) Conc <- c(20, 20, 40, 40, 20, 20, 40, 40) interaction(Temp, Conc)