crossFactors {s20x}R Documentation

Crossed Factors

Description

Computes a factor that has a level for each combination of the factors "fac1" and "fac2".

Usage

crossFactors(x, fac2 = NULL, ...)
## Default S3 method:
crossFactors(x, fac2 = NULL, ...)
## S3 method for class 'formula':
crossFactors(formula, fac2 = NULL, data = NULL, ...)

Arguments

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

Value

Returns a vector containing the factor which represents the interaction of the given factors.

See Also

"factor".

Examples

## 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


[Package s20x version 3.1-5 Index]