fac.genfactors | R Documentation |
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
.
fac.genfactors(factors, ...)
factors |
A |
... |
Further arguments passed to the |
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
.
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
.
Chris Brien
fac.gen
in package dae
## 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.