planor.factors {planor} | R Documentation

## Create an Object of Class designfactors

### Description

Create an object of class `designfactors`, from the factor names and their numbers of levels, or from a named list of factor levels. Both ways can be used in the same call. Additional information can be provided: they will be used during the design search or in the summary functions applied to the object.

### Usage

    planor.factors(factors = NULL, nlevels = NULL,
      block = NULL, ordered = NULL, hierarchy = NULL,
      dummy = FALSE)

### Arguments

`factors` | a character vector of factor names, or possibly a scalar, a dataframe or a list (see DETAILS).
`nlevels` | a vector of level numbers for each factor name (see DETAILS).
`block` | an additive model formula to indicate the block factors.
`ordered` | an additive model formula to indicate the quantitative factors (not used at all in the present version).
`hierarchy` | a formula or a list of formulae to indicate hierarchy relationships between factors (see the planor vignette for details).
`dummy` | a logical to identify dummy factors created and deleted by planor functions for technical reasons.

### Value

An object of class `designfactors`.

### Note

The basic usage is to specify the names of the factors by a character vector of length n in argument `factors` and their numbers of levels by a numeric vector of length n in argument `nlevels`. Alternatively, the `factors` argument can be an integer n, in which case the first n capital letters of the alphabet are used as factor names. If `nlevels` is a scalar s, it is considered that all factors have s levels. There are two more possibilities which allow for alphanumeric factor levels. If `factors` is a dataframe, the factors in this dataframe are extracted together with their levels. Finally `factors` can be a named list of n vectors, with each vector containing the levels of one factor. Note that `nlevels` is ignored in these latter two cases. See the examples. The argument `block` allows to specify the block or nuisance factors. This information is used by the `alias` and `summary` functions but it has no effect on the design generation and randomization which depend on other arguments.

### Author(s)

Monod, H. and Bouvier, A.

### See Also

Class `designfactors`

### Examples

    planor.factors(c("A","B","C","P"),c(2,3,6,3))
    planor.factors(LETTERS[1:12],2)
    planor.factors(12,2)
    planor.factors( c("A","B","Block"), 3, block=~Block)
    zz <- planor.factors( c("A","B","Block"), c(2,3,5))
    zz@levels$A <- c("plus","moins")
    planor.factors(factors=list(A=c("plus","moins"), B=1:3, Block=1:5))
    AB <- data.frame( A=c(rep(c("a","b"),3)), B=rep(c("z","zz","zzz"),rep(2,3)), C=1:6)
    planor.factors(factors=AB)

[Package planor version 1.5-1 Index]