fac.gen {dae} | R Documentation |
Generate all combinations of several factors.
fac.gen(generate, each=1, times=1, order="standard")
generate |
list named objects and numbers that specify the factors whose levels are to be generated and the pattern in these levels. If a component of the list is named, then the component should be 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. |
each |
the number of times to replicate consecutively the elements of the
levels generated according to pattern specified by the
generate argument. |
times |
the number of times to repeat the whole generated pattern of
levels generated according to pattern specified by the
generate argument. |
order |
Either standard or yates . The order in which the
speed of cycling through the levels is to move;
combinations of the factors are to be considered as numbered;
standard cycles through the levels of the first
factor slowest and the last factor moving fastest;
yates cycles through the levels of the first factor
fastest and last factor moving slowest. |
The levels of each factor are generated in a hierarchical pattern where the levels of one factor are held constant while those of the adjacent factor are cycled through the complete set once. If a number is supplied instead of a name, the pattern is generated as if a factor with that number of levels had been supplied in the same position as the number. However, no levels are stored for this unamed factor.
A data frame of generated levels with columns corresponding to the
factors in the generate
list.
Avoid using factor names F and T as these can get confused with FALSE and TRUE.
mp <- c("-", "+") fnames <- list(Catal = mp, Temp = mp, Press = mp, Conc = mp) Fac4Proc.Treats <- fac.gen(generate = fnames, order="yates") gen <- list(A = 3, 3, B = c(0,100,200), 4, D = c("0","1")) fac.gen(gen, times=2, each=2)