dae (version 3.0-32)

fac.divide: Divides a factor into several individual factors

Description

Takes a factor and divides it into several individual 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 individual factors when these are arranged in standard or Yates order.

Usage

fac.divide(combined.factor, factor.names, order="standard")

Arguments

combined.factor

A factor that is to be divided into the individual factors listed in factor.names.

factor.names

A list of factors to be formed. The names in the list are the names of the factors and the component of a name is either a) a single numeric value that is the number of levels, b) a numeric vector that contains the levels of the factor, or c) a character vector that contains the labels of the levels of the factor.

order

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

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.

See Also

fac.combine in package dae.

Examples

Run this code
# NOT RUN {
## 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 factor A nd B
CRD.facs <- fac.divide(CRD.lay$treat, factor.names = list(A = 2, B = 2))
# }

Run the code above in your browser using DataCamp Workspace