fac.divide {dae} | R Documentation |
Divides a factor into several separate factors
Description
Takes a factor
and divides it into several separate
factors
as if the levels
in the original combined.factor
are numbered from one to its number of levels and correspond
to the numbering of the levels
combinations of the new
factors
when these are arranged in standard or Yates order.
Usage
fac.divide(combined.factor, factor.names, order="standard")
Arguments
combined.factor |
A |
factor.names |
A |
order |
Either |
Value
A data.frame
whose columns consist of the factors
listed in
factor.names
and whose values have been computed from the combined
factor
. All the factors
will be of the same length.
Note
A single factor
name may be supplied in the list
in which case
a data.frame
is produced that contains the single factor
computed from the numeric vector
. This may be useful when calling
this function
from others.
Author(s)
Chris Brien
See Also
fac.split
, fac.uncombine
, fac.combine
in package dae.
Examples
## generate a small completely randomized design for 6 treatments
n <- 12
CRD.unit <- list(Unit = n)
treat <- factor(rep(1:4, each = 3))
CRD.lay <- designRandomize(allocated = treat, recipient = CRD.unit, seed=956)
## divide the treatments into two two-level factors A and B
CRD.facs <- fac.divide(CRD.lay$treat, factor.names = list(A = 2, B = 2))