Create an Object of Class designfactors
object of class
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.
1 2 3
a character vector of factor names, or possibly a scalar, a dataframe or a list (see DETAILS).
a vector of level numbers for each factor name (see DETAILS).
an additive model formula to indicate the block factors.
an additive model formula to indicate the quantitative factors (not used at all in the present version).
a formula or a list of formulae to indicate hierarchy relationships between factors (see the planor vignette for details).
a logical to identify dummy factors created and deleted by planor functions for technical reasons.
An object of class
The basic usage is to specify the names of the factors by a
character vector of length n in argument
their numbers of levels by a numeric vector of length n in
nlevels. Alternatively, the
can be an integer n, in which case the first n capital
letters of the alphabet are used as factor names. If
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
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
summary functions but it has no effect on the design
generation and randomization which depend on other arguments.
Monod, H. and Bouvier, A.
1 2 3 4 5 6 7 8 9
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)