fac.genfactors: Generate all combinations of the levels of the supplied...

View source: R/fac.gen.r

fac.genfactorsR Documentation

Generate all combinations of the levels of the supplied factors, without replication

Description

Generate all combinations of the levels of the supplied factors, without replication. This function extracts the levels from the supplied factors and uses them to generate the new factors. On the other hand, the levels must supplied in the generate argument of the function fac.gen.

Usage

fac.genfactors(factors, ...)

Arguments

factors

A list of factors, or an object of factors that is coercible to a list.

...

Further arguments passed to the fac.gen in creating the data.frame of new factors.

Details

The levels of each factor are generated in standard order, unless order is supplied to fac.gen via the ‘...’ argument. The levels of the new factors will be in the same order as in the supplied factors.

Value

A data.frame whose columns correspond to factors in the factors list. The values in a column are the generated levels of the factor. The number of rows in the data.frame will equal the product of the numbers of levels of the supplied factors.

Author(s)

Chris Brien

See Also

fac.gen in package dae

Examples

## generate a treatments key for the Variety and Nitrogen treatments factors in Oats.dat
data(Oats.dat)
trts.key <- fac.genfactors(factors = Oats.dat[c("Variety", "Nitrogen")])
trts.key$Treatment <- factor(1:nrow(trts.key))

dae documentation built on June 22, 2024, 9:07 a.m.