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 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.

### 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

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))


[Package dae version 3.2.28 Index]