fac.combine {dae}R Documentation

Combines several factors into one

Description

Combines several factors into one whose levels are the combinations of the used levels of the individual factors.

Usage

fac.combine(factors, order="standard", combine.levels=FALSE, sep=",", ...)

Arguments

factors

A list of factors all of the same length.

order

Either standard or yates. The order in which the levels combinations of the factors are to be considered as numbered when forming the levels of the combined factor; standard numbers them as if they are arranged in standard order, that is with the levels of the first factor moving slowest and those of the last factor moving fastest; yates numbers them as if they are arranged in Yates order, that is with the levels of the first factor moving fastest and those of the last factor moving slowest.

combine.levels

A logical specifying whether the levels labels of the new factor are to be combined from those of the factors being combined. The default is to use the integers from 1 to the product of the numbers of combinations of used levels of the individual factors, numbering the levels according to order.

sep

A character string to separate the levels when combine.levels = TRUE.

...

Further arguments passed to the factor call creating the new factor.

Value

A factor whose levels are formed form the observed combinations of the levels of the individual factors.

Author(s)

Chris Brien

See Also

fac.uncombine, fac.split, fac.divide in package dae.

Examples

## set up two factors
A <- factor(rep(1:2, each=6))
B <- factor(rep(1:3, each=2, times=2))

## obtain six-level factor corresponding to the combinations of A and B
AB <- fac.combine(list(A,B))

[Package dae version 3.2.28 Index]