crossFactors: Crossed Factors

Description Usage Arguments Value Methods (by class) Note See Also Examples

View source: R/crossFactors.R

Description

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

Usage

1
2
3
4
5
6
7
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 - ignored if x is a formula.

...

Optional arguments

formula

a formula in the form ~ fac1 * fac2

data

an optional data frame in which to evaluate the formula

Value

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

Methods (by class)

Note

This function actually returns a factor now instead of a character string, so coercion into a factor is no longer necessary.

See Also

factor.

Examples

1
2
3
4
5
6
7
8
9
## arousal data:
data(arousal.df)
gender.picture = crossFactors(arousal.df$gender, arousal.df$picture)
gender.picture

## arousal data:
data(arousal.df)
gender.picture = crossFactors(~ gender * picture, data = arousal.df)
gender.picture

s20x documentation built on Aug. 23, 2021, 9:15 a.m.

Related to crossFactors in s20x...