crossFactors {s20x} | R Documentation |
Computes a factor that has a level for each combination of the factors "fac1" and "fac2".
crossFactors(x, fac2 = NULL, ...) ## Default S3 method: crossFactors(x, fac2 = NULL, ...) ## S3 method for class 'formula': crossFactors(formula, fac2 = NULL, data = NULL, ...)
x |
the name of the first factor or a formula in the form ~fac1*fac2 |
fac2 |
the name of the second factor - optional if x is a formula. |
formula |
a formula in the form ~fac1*fac2 |
data |
an optional data frame in which to evaluate the formula |
... |
Optional arguments |
Returns a vector containing the factor which represents the interaction of the given factors.
"factor".
## arousal data: data(arousal.df) gender.picture<-factor(crossFactors(arousal.df$gender,arousal.df$picture)) gender.picture ## arousal data: data(arousal.df) gender.picture<-factor(crossFactors(~gender*picture, data = arousal.df)) gender.picture